From 543dd6bf718703b1000f451b6c5ea8f61eafec2c Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Thu, 25 Apr 2024 15:57:06 +0000 Subject: [PATCH] new build --- ...frame-hand-tracking-controls-extras.min.js | 1 + dist/aframe-troika-text.min.js | 18 + dist/xrfragment.aframe.all.js | 80 +- dist/xrfragment.aframe.js | 80 +- dist/xrfragment.module.js | 436829 +++++++++++++++ dist/xrfragment.plugin.frontend.css.js | 11 +- dist/xrfragment.plugin.frontend.js | 303 +- dist/xrfragment.plugin.network.js | 128 +- dist/xrfragment.three.js | 66 +- dist/xrfragment.three.module.js | 66 +- 10 files changed, 437434 insertions(+), 148 deletions(-) create mode 100644 dist/aframe-hand-tracking-controls-extras.min.js create mode 100644 dist/aframe-troika-text.min.js diff --git a/dist/aframe-hand-tracking-controls-extras.min.js b/dist/aframe-hand-tracking-controls-extras.min.js new file mode 100644 index 0000000..fce1da9 --- /dev/null +++ b/dist/aframe-hand-tracking-controls-extras.min.js @@ -0,0 +1 @@ +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;ijoints.Wrist,getThumbMetacarpal:()=>joints.T_Metacarpal,getThumbProximal:()=>joints.T_Proximal,getThumbDistal:()=>joints.T_Distal,getThumbTip:()=>joints.T_Tip,getIndexMetacarpal:()=>joints.I_Metacarpal,getIndexProximal:()=>joints.I_Proximal,getIndexIntermediate:()=>joints.I_Intermediate,getIndexDistal:()=>joints.I_Distal,getIndexTip:()=>joints.I_Tip,getMiddleMetacarpal:()=>joints.M_Metacarpal,getMiddleProximal:()=>joints.M_Proximal,getMiddleIntermediate:()=>joints.M_Intermediate,getMiddleDistal:()=>joints.M_Distal,getMiddleTip:()=>joints.M_Tip,getRingMetacarpal:()=>joints.R_Metacarpal,getRingProximal:()=>joints.R_Proximal,getRingIntermediate:()=>joints.R_Intermediate,getRingDistal:()=>joints.R_Distal,getRingTip:()=>joints.R_Tip,getLittleMetacarpal:()=>joints.L_Metacarpal,getLittleProximal:()=>joints.L_Proximal,getLittleIntermediate:()=>joints.L_Intermediate,getLittleDistal:()=>joints.L_Distal,getLittleTip:()=>joints.L_Tip};this.updateData=((controller,frame,referenceSpace)=>{frame.fillJointRadii(controller.hand.values(),radii);validPoses=frame.fillPoses(controller.hand.values(),referenceSpace,transforms);if(!validPoses)return});const normalQuaternion=(new THREE.Quaternion).setFromEuler(new THREE.Euler(Math.PI/2,0,0));this.getOrientedQuaternion=((id,_quaternion)=>{return this.getQuaternion(id,_quaternion)});this.getDirection=((id,_vector)=>{const mtxOffset=id*16;const vector=_vector?_vector:tmpVector.clone();return vector.fromArray(transforms,mtxOffset+8).normalize().negate()});this.getNormal=((id,_vector)=>{let vector=_vector?_vector:tmpVector.clone();this.getQuaternion(id,tmpQuaternion).multiply(normalQuaternion);tmpDummy.quaternion.copy(tmpQuaternion);tmpDummy.getWorldDirection(vector);return vector});this.getQuaternion=((id,_quaternion)=>{const mtxOffset=id*16;let quaternion=_quaternion?_quaternion:tmpQuaternion.clone();var idx=0;for(var i=mtxOffset;i<=mtxOffset+12;i++){rotMtx.elements[idx++]=transforms[i]}quaternion.setFromRotationMatrix(rotMtx);return quaternion});this.getPosition=((id,_vector)=>{const mtxOffset=id*16;let vector=_vector?_vector:tmpVector.clone();return vector.fromArray(transforms,mtxOffset+12)});this.getRadius=(id=>{return radii[id]});this.getValidity=(()=>validPoses)}},{"./JointObject":1}]},{},[2]); diff --git a/dist/aframe-troika-text.min.js b/dist/aframe-troika-text.min.js new file mode 100644 index 0000000..076062b --- /dev/null +++ b/dist/aframe-troika-text.min.js @@ -0,0 +1,18 @@ +!function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=n(e),o=r(t);function i(){var e=Object.create(null);function t(n,a){var o=n.id,i=n.name,s=n.dependencies;void 0===s&&(s=[]);var l=n.init;void 0===l&&(l=function(){});var u=n.getTransferables;if(void 0===u&&(u=null),!e[o])try{s=s.map((function(r){return r&&r.isWorkerModule&&(t(r,(function(e){if(e instanceof Error)throw e})),r=e[r.id].value),r})),l=r("<"+i+">.init",l),u&&(u=r("<"+i+">.getTransferables",u));var f=null;"function"==typeof l?f=l.apply(void 0,s):console.error("worker module init function failed to rehydrate"),e[o]={id:o,value:f,getTransferables:u},a(f)}catch(e){e&&e.noLog||console.error(e),a(e)}}function r(e,t){var r=void 0;self.troikaDefine=function(e){return r=e};var n=URL.createObjectURL(new Blob(["/** "+e.replace(/\*/g,"")+" **/\n\ntroikaDefine(\n"+t+"\n)"],{type:"application/javascript"}));try{importScripts(n)}catch(e){console.error(e)}return URL.revokeObjectURL(n),delete self.troikaDefine,r}self.addEventListener("message",(function(r){var n=r.data,a=n.messageId,o=n.action,i=n.data;try{"registerModule"===o&&t(i,(function(e){e instanceof Error?postMessage({messageId:a,success:!1,error:e.message}):postMessage({messageId:a,success:!0,result:{isCallable:"function"==typeof e}})})),"callModule"===o&&function(t,r){var n,a=t.id,o=t.args;e[a]&&"function"==typeof e[a].value||r(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var i=(n=e[a]).value.apply(n,o);i&&"function"==typeof i.then?i.then(s,(function(e){return r(e instanceof Error?e:new Error(""+e))})):s(i)}catch(e){r(e)}function s(t){try{var n=e[a].getTransferables&&e[a].getTransferables(t);n&&Array.isArray(n)&&n.length||(n=void 0),r(t,n)}catch(e){console.error(e),r(e)}}}(i,(function(e,t){e instanceof Error?postMessage({messageId:a,success:!1,error:e.message}):postMessage({messageId:a,success:!0,result:e},t||void 0)}))}catch(e){postMessage({messageId:a,success:!1,error:e.stack})}}))}var s=function(){var e=!1;if("undefined"!=typeof window&&void 0!==window.document)try{new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"}))).terminate(),e=!0}catch(e){"undefined"!=typeof process&&"test"===process.env.NODE_ENV||console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+e.message+"]")}return s=function(){return e},e},l=0,u=0,f=!1,c=Object.create(null),h=Object.create(null),d=Object.create(null);function p(e){if(!(e&&"function"==typeof e.init||f))throw new Error("requires `options.init` function");var t=e.dependencies,r=e.init,n=e.getTransferables,a=e.workerId;if(!s())return function(e){var t=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return t._getInitResult().then((function(t){if("function"==typeof t)return t.apply(void 0,e);throw new Error("Worker module function was called but `init` did not return a callable function")}))};return t._getInitResult=function(){var r=e.dependencies,n=e.init;r=Array.isArray(r)?r.map((function(e){return e&&e._getInitResult?e._getInitResult():e})):[];var a=Promise.all(r).then((function(e){return n.apply(null,e)}));return t._getInitResult=function(){return a},a},t}(e);null==a&&(a="#default");var o="workerModule"+ ++l,i=e.name||o,u=null;function c(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(!u){u=g(a,"registerModule",c.workerModuleData);var r=function(){u=null,h[a].delete(r)};(h[a]||(h[a]=new Set)).add(r)}return u.then((function(t){if(t.isCallable)return g(a,"callModule",{id:o,args:e});throw new Error("Worker module function was called but `init` did not return a callable function")}))}return t=t&&t.map((function(e){return"function"!=typeof e||e.workerModuleData||(f=!0,e=p({workerId:a,name:"<"+i+"> function dependency: "+e.name,init:"function(){return (\n"+v(e)+"\n)}"}),f=!1),e&&e.workerModuleData&&(e=e.workerModuleData),e})),c.workerModuleData={isWorkerModule:!0,id:o,name:i,dependencies:t,init:v(r),getTransferables:n&&v(n)},c}function v(e){var t=e.toString();return!/^function/.test(t)&&/^\w+\s*\(/.test(t)&&(t="function "+t),t}function g(e,t,r){return new Promise((function(n,a){var o=++u;d[o]=function(e){e.success?n(e.result):a(new Error("Error in worker "+t+" call: "+e.error))},function(e){var t=c[e];if(!t){var r=v(i);(t=c[e]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+e.replace(/\*/g,"")+" **/\n\n;("+r+")()"],{type:"application/javascript"})))).onmessage=function(e){var t=e.data,r=t.messageId,n=d[r];if(!n)throw new Error("WorkerModule response with empty or unknown messageId");delete d[r],n(t)}}return t}(e).postMessage({messageId:o,action:t,data:r})}))}function m(){var e=function(e){function t(e,t,r,n,a,o,i,s,l,u){var f=1-l;u.x=f*f*f*e+3*f*f*l*r+3*f*l*l*a+l*l*l*i,u.y=f*f*f*t+3*f*f*l*n+3*f*l*l*o+l*l*l*s}function r(e,t){for(var r,n,a,o,i,s=/([MLQCZ])([^MLQCZ]*)/g;r=s.exec(e);){var l=r[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map((function(e){return parseFloat(e)}));switch(r[1]){case"M":o=n=l[0],i=a=l[1];break;case"L":l[0]===o&&l[1]===i||t("L",o,i,o=l[0],i=l[1]);break;case"Q":t("Q",o,i,o=l[2],i=l[3],l[0],l[1]);break;case"C":t("C",o,i,o=l[4],i=l[5],l[0],l[1],l[2],l[3]);break;case"Z":o===n&&i===a||t("L",o,i,n,a)}}}function n(e,n,a){void 0===a&&(a=16);var o={x:0,y:0};r(e,(function(e,r,i,s,l,u,f,c,h){switch(e){case"L":n(r,i,s,l);break;case"Q":for(var d=r,p=i,v=1;v0;)n[a]=arguments[a+2];var o=s[t]||(s[t]=r.getUniformLocation(u,t));r["uniform"+e].apply(r,[o].concat(n))},setAttribute:function(e,t,n,o,s){var l=i[e];l||(l=i[e]={buf:r.createBuffer(),loc:r.getAttribLocation(u,e),data:null}),r.bindBuffer(r.ARRAY_BUFFER,l.buf),r.vertexAttribPointer(l.loc,t,r.FLOAT,!1,0,0),r.enableVertexAttribArray(l.loc),a?r.vertexAttribDivisor(l.loc,o):h("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(l.loc,o),s!==l.data&&(r.bufferData(r.ARRAY_BUFFER,s,n),l.data=s)}})}}}l[e].transaction(o)}function v(e,t){f++;try{r.activeTexture(r.TEXTURE0+f);var n=u[e];n||(n=u[e]=r.createTexture(),r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST)),r.bindTexture(r.TEXTURE_2D,n),t(n,f)}finally{f--}}function g(e,t,n){var a=r.createFramebuffer();c.push(a),r.bindFramebuffer(r.FRAMEBUFFER,a),r.activeTexture(r.TEXTURE0+t),r.bindTexture(r.TEXTURE_2D,e),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);try{n(a)}finally{r.deleteFramebuffer(a),r.bindFramebuffer(r.FRAMEBUFFER,c[--c.length-1]||null)}}function m(){s={},l={},u={},f=-1,c.length=0}r.canvas.addEventListener("webglcontextlost",(function(e){m(),e.preventDefault()}),!1),o.set(r,n={gl:r,isWebGL2:a,getExtension:h,withProgram:p,withTexture:v,withTextureFramebuffer:g,handleContextLoss:m})}t(n)}function l(e,t,r,n,o,i,l,u){void 0===l&&(l=15),void 0===u&&(u=null),s(e,(function(e){var s=e.gl,f=e.withProgram;(0,e.withTexture)("copy",(function(e,c){s.texImage2D(s.TEXTURE_2D,0,s.RGBA,o,i,0,s.RGBA,s.UNSIGNED_BYTE,t),f("copy",a,"precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",(function(e){var t=e.setUniform;(0,e.setAttribute)("aUV",2,s.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),t("1i","image",c),s.bindFramebuffer(s.FRAMEBUFFER,u||null),s.disable(s.BLEND),s.colorMask(8&l,4&l,2&l,1&l),s.viewport(r,n,o,i),s.scissor(r,n,o,i),s.drawArrays(s.TRIANGLES,0,3)}))}))}))}var u=Object.freeze({__proto__:null,withWebGLContext:s,renderImageData:l,resizeWebGLCanvasWithoutClearing:function(e,t,r){var n=e.width,a=e.height;s(e,(function(o){var i=o.gl,s=new Uint8Array(n*a*4);i.readPixels(0,0,n,a,i.RGBA,i.UNSIGNED_BYTE,s),e.width=t,e.height=r,l(i,s,0,0,n,a)}))}});function f(e,t,r,a,o,i){void 0===i&&(i=1);var s=new Uint8Array(e*t),l=a[2]-a[0],u=a[3]-a[1],f=[];n(r,(function(e,t,r,n){f.push({x1:e,y1:t,x2:r,y2:n,minX:Math.min(e,r),minY:Math.min(t,n),maxX:Math.max(e,r),maxY:Math.max(t,n)})})),f.sort((function(e,t){return e.maxX-t.maxX}));for(var c=0;co.minX&&t-no.minY){var i=d(e,t,o.x1,o.y1,o.x2,o.y2);it!=a.y2>t&&e<(a.x2-a.x1)*(t-a.y1)/(a.y2-a.y1)+a.x1&&(r+=a.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y/gm,(function(t,r){let n=e.ShaderChunk[r];return n?b(n):t}))}const x=[];for(let e=0;e<256;e++)x[e]=(e<16?"0":"")+e.toString(16);const S=Object.assign||function(){let e=arguments[0];for(let t=1,r=arguments.length;t/gm,"\n//!BEGIN_POST_CHUNK $1\n$&\n//!END_POST_CHUNK\n")));if(d){let e=d({vertexShader:t,fragmentShader:r});t=e.vertexShader,r=e.fragmentShader}if(h){let e=[];r=r.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,(t=>(e.push(t),""))),c=`${h}\n${e.join("\n")}\n${c}`}if(p){const e=`\nuniform float ${p};\n`;o=e+o,u=e+u}l&&(o=`${o}\nvoid troikaVertexTransform${a}(inout vec3 position, inout vec3 normal, inout vec2 uv) {\n ${l}\n}\n`,i=`\ntroika_position_${a} = vec3(position);\ntroika_normal_${a} = vec3(normal);\ntroika_uv_${a} = vec2(uv);\ntroikaVertexTransform${a}(troika_position_${a}, troika_normal_${a}, troika_uv_${a});\n${i}\n`,t=(t=`vec3 troika_position_${a};\nvec3 troika_normal_${a};\nvec2 troika_uv_${a};\n${t}\n`).replace(/\b(position|normal|uv)\b/g,((e,t,r,n)=>/\battribute\s+vec[23]\s+$/.test(n.substr(0,r))?t:`troika_${t}_${a}`)),e.map&&e.map.channel>0||(t=t.replace(/\bMAP_UV\b/g,`troika_uv_${a}`)));return t=F(t,a,o,i,s),r=F(r,a,u,f,c),{vertexShader:t,fragmentShader:r}}(this,e,r,n);s=w[i]=t}e.vertexShader=s.vertexShader,e.fragmentShader=s.fragmentShader,S(e.uniforms,this.uniforms),r.timeUniform&&(e.uniforms[r.timeUniform]={get value(){return Date.now()-U}}),this[o]&&this[o](e)},s=function(){return l(r.chained?t:t.clone())},l=function(e){const a=Object.create(e,u);return Object.defineProperty(a,"baseMaterial",{value:t}),Object.defineProperty(a,"id",{value:T++}),a.uuid=function(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(x[255&e]+x[e>>8&255]+x[e>>16&255]+x[e>>24&255]+"-"+x[255&t]+x[t>>8&255]+"-"+x[t>>16&15|64]+x[t>>24&255]+"-"+x[63&r|128]+x[r>>8&255]+"-"+x[r>>16&255]+x[r>>24&255]+x[255&n]+x[n>>8&255]+x[n>>16&255]+x[n>>24&255]).toUpperCase()}(),a.uniforms=S({},e.uniforms,r.uniforms),a.defines=S({},e.defines,r.defines),a.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",a.extensions=S({},e.extensions,r.extensions),a._listeners=void 0,a},u={constructor:{value:s},isDerivedMaterial:{value:!0},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return t.customProgramCacheKey()+"|"+n}},onBeforeCompile:{get:()=>i,set(e){this[o]=e}},copy:{writable:!0,configurable:!0,value:function(r){return t.copy.call(this,r),t.isShaderMaterial||t.isDerivedMaterial||(S(this.extensions,r.extensions),S(this.defines,r.defines),S(this.uniforms,e.UniformsUtils.clone(r.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const e=new t.constructor;return l(e).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let n=this._depthMaterial;return n||(n=this._depthMaterial=_(t.isDerivedMaterial?t.getDepthMaterial():new e.MeshDepthMaterial({depthPacking:e.RGBADepthPacking}),r),n.defines.IS_DEPTH_MATERIAL="",n.uniforms=this.uniforms),n}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let n=this._distanceMaterial;return n||(n=this._distanceMaterial=_(t.isDerivedMaterial?t.getDistanceMaterial():new e.MeshDistanceMaterial,r),n.defines.IS_DISTANCE_MATERIAL="",n.uniforms=this.uniforms),n}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:e,_distanceMaterial:r}=this;e&&e.dispose(),r&&r.dispose(),t.dispose.call(this)}}};return a[n]=s,new s}function F(e,t,r,n,a){return(n||a||r)&&(e=e.replace(y,`\n${r}\nvoid troikaOrigMain${t}() {`),e+=`\nvoid main() {\n ${n}\n troikaOrigMain${t}();\n ${a}\n}`),e}function C(e,t){return"uniforms"===e?void 0:"function"==typeof t?t.toString():t}let D=0;const A=new Map;const O=p({name:"Typr Font Parser",dependencies:[function(){return"undefined"==typeof window&&(self.window=self),function(e){var t={parse:function(e){var r=t._bin,n=new Uint8Array(e);if("ttcf"==r.readASCII(n,0,4)){var a=4;r.readUshort(n,a),a+=2,r.readUshort(n,a),a+=2;var o=r.readUint(n,a);a+=4;for(var i=[],s=0;s>>r&1)&&t++;return t},t._lctf.readClassDef=function(e,r){var n=t._bin,a=[],o=n.readUshort(e,r);if(r+=2,1==o){var i=n.readUshort(e,r);r+=2;var s=n.readUshort(e,r);r+=2;for(var l=0;l0&&(o.featureParams=a+i);var s=n.readUshort(e,r);r+=2,o.tab=[];for(var l=0;l0&&(o.default=t._lctf.readLangSysTable(e,a+i));var s=n.readUshort(e,r);r+=2;for(var l=0;l255?-1:t.CFF.glyphByUnicode(e,t.CFF.tableSE[r])},t.CFF.readEncoding=function(e,r,n){t._bin;var a=[".notdef"],o=e[r];if(r++,0!=o)throw"error: unknown encoding format: "+o;var i=e[r];r++;for(var s=0;s>4,v=15&d;if(15!=p&&h.push(p),15!=v&&h.push(v),15==v)break}for(var g="",m=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],y=0;y=i.xMax||i.yMin>=i.yMax)return null;if(i.noc>0){i.endPts=[];for(var s=0;s=1&&s.fmt<=2){u=o.readUshort(e,n),n+=2;var c=o.readUshort(e,n);n+=2,f=t._lctf.numOfOnes(u);var h=t._lctf.numOfOnes(c);if(1==s.fmt){s.pairsets=[];var d=o.readUshort(e,n);n+=2;for(var p=0;p=1&&s.fmt<=2){if(1==s.fmt)s.delta=o.readShort(e,n),n+=2;else if(2==s.fmt){var u=o.readUshort(e,n);n+=2,s.newg=o.readUshorts(e,n,u),n+=2*s.newg.length}}else if(4==r){s.vals=[],u=o.readUshort(e,n),n+=2;for(var f=0;f>>8;if(0!=(c&=15))throw"unknown kern table format: "+c;r=t.kern.readFormat0(e,r,l)}return l},t.kern.parseV1=function(e,r,n,a){var o=t._bin;o.readFixed(e,r),r+=4;var i=o.readUint(e,r);r+=4;for(var s={glyph1:[],rval:[]},l=0;l>>8;if(0!=(f&=15))throw"unknown kern table format: "+f;r=t.kern.readFormat0(e,r,s)}return s},t.kern.readFormat0=function(e,r,n){var a=t._bin,o=-1,i=a.readUshort(e,r);r+=2,a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2;for(var s=0;s=a.map.length?0:a.map[t];if(4==a.format){for(var o=-1,i=0;it?0:65535&(0!=a.idRangeOffset[o]?a.glyphIdArray[t-a.startCount[o]+(a.idRangeOffset[o]>>1)-(a.idRangeOffset.length-o)]:t+a.idDelta[o])}if(12==a.format){if(t>a.groups[a.groups.length-1][1])return 0;for(i=0;i-1?t.U._simpleGlyph(a,n):t.U._compoGlyph(a,r,n))},t.U._simpleGlyph=function(e,r){for(var n=0;no)){for(var d=!0,p=0,v=0;vo)){for(d=!0,v=0;v>1,i.length=0,l=!0;else if("o3"==T||"o23"==T)i.length%2!=0&&!l&&(u=i.shift()+a.nominalWidthX),s+=i.length>>1,i.length=0,l=!0;else if("o4"==T)i.length>1&&!l&&(u=i.shift()+a.nominalWidthX,l=!0),f&&t.U.P.closePath(o),d+=i.pop(),t.U.P.moveTo(o,h,d),f=!0;else if("o5"==T)for(;i.length>0;)h+=i.shift(),d+=i.shift(),t.U.P.lineTo(o,h,d);else if("o6"==T||"o7"==T)for(var _=i.length,F="o6"==T,C=0;C<_;C++){var D=i.shift();F?h+=D:d+=D,F=!F,t.U.P.lineTo(o,h,d)}else if("o8"==T||"o24"==T){_=i.length;for(var A=0;A+6<=_;)p=h+i.shift(),v=d+i.shift(),g=p+i.shift(),m=v+i.shift(),h=g+i.shift(),d=m+i.shift(),t.U.P.curveTo(o,p,v,g,m,h,d),A+=6;"o24"==T&&(h+=i.shift(),d+=i.shift(),t.U.P.lineTo(o,h,d))}else{if("o11"==T)break;if("o1234"==T||"o1235"==T||"o1236"==T||"o1237"==T)"o1234"==T&&(v=d,g=(p=h+i.shift())+i.shift(),k=m=v+i.shift(),b=m,S=d,h=(x=(y=(U=g+i.shift())+i.shift())+i.shift())+i.shift(),t.U.P.curveTo(o,p,v,g,m,U,k),t.U.P.curveTo(o,y,b,x,S,h,d)),"o1235"==T&&(p=h+i.shift(),v=d+i.shift(),g=p+i.shift(),m=v+i.shift(),U=g+i.shift(),k=m+i.shift(),y=U+i.shift(),b=k+i.shift(),x=y+i.shift(),S=b+i.shift(),h=x+i.shift(),d=S+i.shift(),i.shift(),t.U.P.curveTo(o,p,v,g,m,U,k),t.U.P.curveTo(o,y,b,x,S,h,d)),"o1236"==T&&(p=h+i.shift(),v=d+i.shift(),g=p+i.shift(),k=m=v+i.shift(),b=m,x=(y=(U=g+i.shift())+i.shift())+i.shift(),S=b+i.shift(),h=x+i.shift(),t.U.P.curveTo(o,p,v,g,m,U,k),t.U.P.curveTo(o,y,b,x,S,h,d)),"o1237"==T&&(p=h+i.shift(),v=d+i.shift(),g=p+i.shift(),m=v+i.shift(),U=g+i.shift(),k=m+i.shift(),y=U+i.shift(),b=k+i.shift(),x=y+i.shift(),S=b+i.shift(),Math.abs(x-h)>Math.abs(S-d)?h=x+i.shift():d=S+i.shift(),t.U.P.curveTo(o,p,v,g,m,U,k),t.U.P.curveTo(o,y,b,x,S,h,d));else if("o14"==T){if(i.length>0&&!l&&(u=i.shift()+n.nominalWidthX,l=!0),4==i.length){var O=i.shift(),R=i.shift(),E=i.shift(),M=i.shift(),I=t.CFF.glyphBySE(n,E),P=t.CFF.glyphBySE(n,M);t.U._drawCFF(n.CharStrings[I],r,n,a,o),r.x=O,r.y=R,t.U._drawCFF(n.CharStrings[P],r,n,a,o)}f&&(t.U.P.closePath(o),f=!1)}else if("o19"==T||"o20"==T)i.length%2!=0&&!l&&(u=i.shift()+a.nominalWidthX),s+=i.length>>1,i.length=0,l=!0,c+=s+7>>3;else if("o21"==T)i.length>2&&!l&&(u=i.shift()+a.nominalWidthX,l=!0),d+=i.pop(),h+=i.pop(),f&&t.U.P.closePath(o),t.U.P.moveTo(o,h,d),f=!0;else if("o22"==T)i.length>1&&!l&&(u=i.shift()+a.nominalWidthX,l=!0),h+=i.pop(),f&&t.U.P.closePath(o),t.U.P.moveTo(o,h,d),f=!0;else if("o25"==T){for(;i.length>6;)h+=i.shift(),d+=i.shift(),t.U.P.lineTo(o,h,d);p=h+i.shift(),v=d+i.shift(),g=p+i.shift(),m=v+i.shift(),h=g+i.shift(),d=m+i.shift(),t.U.P.curveTo(o,p,v,g,m,h,d)}else if("o26"==T)for(i.length%2&&(h+=i.shift());i.length>0;)p=h,v=d+i.shift(),h=g=p+i.shift(),d=(m=v+i.shift())+i.shift(),t.U.P.curveTo(o,p,v,g,m,h,d);else if("o27"==T)for(i.length%2&&(d+=i.shift());i.length>0;)v=d,g=(p=h+i.shift())+i.shift(),m=v+i.shift(),h=g+i.shift(),d=m,t.U.P.curveTo(o,p,v,g,m,h,d);else if("o10"==T||"o29"==T){var B="o10"==T?a:n;if(0==i.length)console.debug("error: empty stack");else{var G=i.pop(),L=B.Subrs[G+B.Bias];r.x=h,r.y=d,r.nStems=s,r.haveWidth=l,r.width=u,r.open=f,t.U._drawCFF(L,r,n,a,o),h=r.x,d=r.y,s=r.nStems,l=r.haveWidth,u=r.width,f=r.open}}else if("o30"==T||"o31"==T){var W=i.length,j=(A=0,"o31"==T);for(A+=W-(_=-3&W);A<_;)j?(v=d,g=(p=h+i.shift())+i.shift(),d=(m=v+i.shift())+i.shift(),_-A==5?(h=g+i.shift(),A++):h=g,j=!1):(p=h,v=d+i.shift(),g=p+i.shift(),m=v+i.shift(),h=g+i.shift(),_-A==5?(d=m+i.shift(),A++):d=m,j=!0),t.U.P.curveTo(o,p,v,g,m,h,d),A+=4}else{if("o"==(T+"").charAt(0))throw console.debug("Unknown operation: "+T,e),T;i.push(T)}}}r.x=h,r.y=d,r.nStems=s,r.haveWidth=l,r.width=u,r.open=f};var r=t,n={Typr:r};return e.Typr=r,e.default=n,Object.defineProperty(e,"__esModule",{value:!0}),e}({}).Typr} +/*! + Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate + (https://github.com/101arrowz/fflate) for use in Troika text rendering. + Original licenses apply: + - fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT) + - woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2) + */,function(){return function(e){var t=Uint8Array,r=Uint16Array,n=Uint32Array,a=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),o=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),i=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(e,t){for(var a=new r(31),o=0;o<31;++o)a[o]=t+=1<>>1|(21845&d)<<1;p=(61680&(p=(52428&p)>>>2|(13107&p)<<2))>>>4|(3855&p)<<4,h[d]=((65280&p)>>>8|(255&p)<<8)>>>1}var v=function(e,t,n){for(var a=e.length,o=0,i=new r(t);o>>u]=f}else for(s=new r(a),o=0;o>>15-e[o]);return s},g=new t(288);for(d=0;d<144;++d)g[d]=8;for(d=144;d<256;++d)g[d]=9;for(d=256;d<280;++d)g[d]=7;for(d=280;d<288;++d)g[d]=8;var m=new t(32);for(d=0;d<32;++d)m[d]=5;var y=v(g,9,1),b=v(m,5,1),x=function(e){for(var t=e[0],r=1;rt&&(t=e[r]);return t},S=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&r},U=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},k=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],w=function(e,t,r){var n=new Error(t||k[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,w),!r)throw n;return n},T=function(e,s,l){var f=e.length;if(!f||l&&!l.l&&f<5)return s||new t(0);var h=!s||l,d=!l||l.i;l||(l={}),s||(s=new t(3*f));var p,g=function(e){var r=s.length;if(e>r){var n=new t(Math.max(2*r,e));n.set(s),s=n}},m=l.f||0,k=l.p||0,T=l.b||0,_=l.l,F=l.d,C=l.m,D=l.n,A=8*f;do{if(!_){l.f=m=S(e,k,1);var O=S(e,k+1,3);if(k+=3,!O){var R=e[(N=((p=k)/8|0)+(7&p&&1)+4)-4]|e[N-3]<<8,E=N+R;if(E>f){d&&w(0);break}h&&g(T+R),s.set(e.subarray(N,E),T),l.b=T+=R,l.p=k=8*E;continue}if(1==O)_=y,F=b,C=9,D=5;else if(2==O){var M=S(e,k,31)+257,I=S(e,k+10,15)+4,P=M+S(e,k+5,31)+1;k+=14;for(var B=new t(P),G=new t(19),L=0;L>>4)<16)B[L++]=N;else{var X=0,q=0;for(16==N?(q=3+S(e,k,3),k+=2,X=B[L-1]):17==N?(q=3+S(e,k,7),k+=3):18==N&&(q=11+S(e,k,127),k+=7);q--;)B[L++]=X}}var H=B.subarray(0,M),$=B.subarray(M);C=x(H),D=x($),_=v(H,C,1),F=v($,D,1)}else w(1);if(k>A){d&&w(0);break}}h&&g(T+131072);for(var Y=(1<>>4;if((k+=15&X)>A){d&&w(0);break}if(X||w(2),J<256)s[T++]=J;else{if(256==J){K=k,_=null;break}var Q=J-254;if(J>264){var ee=a[L=J-257];Q=S(e,k,(1<>>4;if(te||w(3),k+=15&te,$=c[re],re>3&&(ee=o[re],$+=U(e,k)&(1<A){d&&w(0);break}h&&g(T+131072);for(var ne=T+Q;Te.length)&&(o=e.length);var i=new(e instanceof r?r:e instanceof n?n:t)(o-a);return i.set(e.subarray(a,o)),i}(s,0,T)},_=new t(0),F="undefined"!=typeof TextDecoder&&new TextDecoder;try{F.decode(_,{stream:!0})}catch(e){}return e.convert_streams=function(e){var t=new DataView(e),r=0;function n(){var e=t.getUint16(r);return r+=2,e}function a(){var e=t.getUint32(r);return r+=4,e}function o(e){m.setUint16(y,e),y+=2}function i(e){m.setUint32(y,e),y+=4}for(var s={signature:a(),flavor:a(),length:a(),numTables:n(),reserved:n(),totalSfntSize:a(),majorVersion:n(),minorVersion:n(),metaOffset:a(),metaLength:a(),metaOrigLength:a(),privOffset:a(),privLength:a()},l=0;Math.pow(2,l)<=s.numTables;)l++;l--;for(var u=16*Math.pow(2,l),f=16*s.numTables-u,c=12,h=[],d=0;d{let[o,i]=n.split("+");o=parseInt(o,36),i=i?parseInt(i,36):0,a.set(r+=o,e[t]);for(let n=i;n--;)a.set(++r,e[t])}))}}return a.get(e)||32}const i=[null,"isol","init","fina","medi"];function s(e){const t=new Uint8Array(e.length);let r=32,n=1,a=-1;for(let i=0;i65535&&i++)}return t}function l(...e){for(let t=0;te.U.codeToGlyph(t,r)>0,forEachGlyph(a,o,l,u){let f=0;const h=1/c.unitsPerEm*o,d=function(t,r){const n=[];for(let a=0;a65535&&a++,n.push(e.U.codeToGlyph(t,o))}const a=t.GSUB;if(a){const{lookupList:t,featureList:o}=a;let l;const u=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,f=[];o.forEach((a=>{if(u.test(a.tag))for(let o=0;o{if(-1!==i){let a=n[i];if(!a){const{cmds:o,crds:s}=e.U.glyphToPath(t,i);let l,u,f,c,h="",d=0;for(let e=0,t=o.length;e1?",":"")+s[d++]}if(s.length){l=u=1/0,f=c=-1/0;for(let e=0,t=s.length;ef&&(f=t),r>c&&(c=r)}}else l=f=u=c=0;a=n[i]={index:i,advanceWidth:t.hmtx.aWidth[i],xMin:l,yMin:u,xMax:f,yMax:c,path:h,pathCommandCount:o.length}}-1!==v&&(f+=e.U.getPairAdjustment(t,v,i)*h),u.call(null,a,f,p),a.advanceWidth&&(f+=a.advanceWidth*h),l&&(f+=l*o),v=i}p+=a.codePointAt(p)>65535?2:1})),f}};return c}return function(r){const n=new Uint8Array(r,0,4),a=e._bin.readASCII(n,0,4);if("wOFF"===a)r=t(r);else if("wOF2"===a)throw new Error("woff2 fonts not supported");return u(e.parse(r)[0])}}],init:(e,t,r)=>r(e(),t())}); +/*! + Custom bundle of @unicode-font-resolver/client v1.0.0 (https://github.com/lojjic/unicode-font-resolver) + for use in Troika text rendering. + Original MIT license applies + */const R=p({name:"FontResolver",dependencies:[function(e,t){const r=Object.create(null),n=Object.create(null);function a(t,a){let o=r[t];o?a(o):n[t]?n[t].push(a):(n[t]=[a],function(t,r){const n=e=>{console.error(`Failure loading font ${t}`,e)};try{const a=new XMLHttpRequest;a.open("get",t,!0),a.responseType="arraybuffer",a.onload=function(){if(a.status>=400)n(new Error(a.statusText));else if(a.status>0)try{const n=e(a.response);n.src=t,r(n)}catch(e){n(e)}},a.onerror=n,a.send()}catch(e){n(e)}}(t,(e=>{e.src=t,r[t]=e,n[t].forEach((t=>t(e))),delete n[t]})))}return function(e,n,{lang:o,fonts:i=[],style:s="normal",weight:l="normal",unicodeFontsURL:u}={}){const f=new Uint8Array(e.length),c=[];e.length||v();const h=new Map,d=[];if("italic"!==s&&(s="normal"),"number"!=typeof l&&(l="bold"===l?700:400),i&&!Array.isArray(i)&&(i=[i]),(i=i.slice().filter((e=>!e.lang||e.lang.test(o))).reverse()).length){const t=1,n=2;let o=0;!function s(l=0){for(let u=l,p=e.length;u{s(u)}));if(e.supportsCodePoint(l)){let r=h.get(e);"number"!=typeof r&&(r=c.length,c.push(e),h.set(e,r)),f[u]=r,o=t;break}}}l>65535&&u+1e.substring(t[0],t[1]+1))).join("\n");t.getFontsForString(r,{lang:o,style:s,weight:l,dataUrl:u}).then((({fontUrls:e,chars:t})=>{const r=c.length;let n=0;d.forEach((e=>{for(let a=0,o=e[1]-e[0];a<=o;a++)f[e[0]+a]=t[n++]+r;n++}));let o=0;e.forEach(((t,n)=>{a(t,(t=>{c[n+r]=t,++o===e.length&&v()}))}))}))}else v()}function v(){n({chars:f,fonts:c})}function g(e,t){for(let r=0;r>5;this.buckets.set(t,(this.buckets.get(t)||0)|1<<(31&e))},t.prototype.has=function(e){var t=this.buckets.get(e>>5);return void 0!==t&&0!=(t&1<<(31&e))},t.prototype.serialize=function(){var e=[];return this.buckets.forEach((function(t,r){e.push((+r).toString(36)+":"+t.toString(36))})),e.join(",")},t.prototype.deserialize=function(e){var t=this;this.buckets.clear(),e.split(",").forEach((function(e){var r=e.split(":");t.buckets.set(parseInt(r[0],36),parseInt(r[1],36))}))};var r=Math.pow(2,8),n=r-1,a=~n;function o(e){var t=function(e){return e&a}(e).toString(16),n=function(e){return(e&a)+r-1}(e).toString(16);return"codepoint-index/plane"+(e>>16)+"/"+t+"-"+n+".json"}function i(e,t){var r=e&n,a=t.codePointAt(r/6|0);return 0!=((a=(a||48)-48)&1<65535&&(t++,_=t)},_=0;_65535&&(t++,n=t)},n=0;n65535&&(o++,y[o]=y[o-1])}return{fontUrls:Array.from(d.keys()),chars:y}}))},Object.defineProperty(e,"__esModule",{value:!0}),e}({})}],init:(e,t,r)=>e(t,r())});const E=()=>(self.performance||Date).now(),M=m();let I;const P=[];let B=0;function G(){const e=E();for(;P.length&&E()-e<5;)P.shift()();B=P.length?setTimeout(G,0):0}const L=(...e)=>new Promise(((t,r)=>{P.push((()=>{const n=E();try{M.webgl.generateIntoCanvas(...e),t({timing:E()-n})}catch(e){r(e)}})),B||(B=setTimeout(G,0))})),W={};let j=0;function z(e,t,r,n,a,o,i,s,l,u){const f="TroikaTextSDFGenerator_JS_"+j++%4;let d=W[f];return d||(d=W[f]={workerModule:p({name:f,workerId:f,dependencies:[m,E],init(e,t){const r=e().javascript.generate;return function(...e){const n=t();return{textureData:r(...e),timing:t()-n}}},getTransferables:e=>[e.textureData.buffer]}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(e,t,r,n,a,o).then((({textureData:r,timing:n})=>{const a=E(),o=new Uint8Array(4*r.length);for(let e=0;e{!function(e){h[e]&&h[e].forEach((function(e){e()})),c[e]&&(c[e].terminate(),delete c[e])}(f)}),2e3)),{timing:n}}))}const N=M.webglUtils.resizeWebGLCanvasWithoutClearing,V={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},X=new e.Color;function q(){return(self.performance||Date).now()}const H=Object.create(null);function $(t,r){t=function(e,t){for(let r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}({},t);const n=q(),{defaultFontURL:a}=V,o=[];if(a&&o.push({label:"default",src:K(a)}),t.font&&o.push({label:"user",src:K(t.font)}),t.font=o,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||V.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||V.unicodeFontsURL,null!=t.colorRanges){let e={};for(let r in t.colorRanges)if(t.colorRanges.hasOwnProperty(r)){let n=t.colorRanges[r];"number"!=typeof n&&(n=X.set(n).getHex()),e[r]=n}t.colorRanges=e}Object.freeze(t);const{textureWidth:i,sdfExponent:s}=V,{sdfGlyphSize:l}=t,u=i/l*4;let f=H[l];if(!f){const t=document.createElement("canvas");t.width=i,t.height=256*l/u,f=H[l]={glyphCount:0,sdfGlyphSize:l,sdfCanvas:t,sdfTexture:new e.Texture(t,void 0,void 0,void 0,e.LinearFilter,e.LinearFilter),contextLost:!1,glyphsByFont:new Map},f.sdfTexture.generateMipmaps=!1,function(e){const t=e.sdfCanvas;t.addEventListener("webglcontextlost",(t=>{console.log("Context Lost",t),t.preventDefault(),e.contextLost=!0})),t.addEventListener("webglcontextrestored",(t=>{console.log("Context Restored",t),e.contextLost=!1;const r=[];e.glyphsByFont.forEach((t=>{t.forEach((t=>{r.push(Y(t,e,!0))}))})),Promise.all(r).then((()=>{J(e),e.sdfTexture.needsUpdate=!0}))}))}(f)}const{sdfTexture:c,sdfCanvas:h}=f;ee(t).then((e=>{const{glyphIds:a,glyphFontIndices:o,fontData:d,glyphPositions:p,fontSize:v,timings:g}=e,m=[],y=new Float32Array(4*a.length);let b=0,x=0;const S=q(),U=d.map((e=>{let t=f.glyphsByFont.get(e.src);return t||f.glyphsByFont.set(e.src,t=new Map),t}));a.forEach(((t,r)=>{const n=o[r],{src:i,unitsPerEm:s}=d[n];let u=U[n].get(t);if(!u){const{path:r,pathBounds:a}=e.glyphData[i][t],o=Math.max(a[2]-a[0],a[3]-a[1])/l*(V.sdfMargin*l+.5),s=f.glyphCount++,c=[a[0]-o,a[1]-o,a[2]+o,a[3]+o];U[n].set(t,u={path:r,atlasIndex:s,sdfViewBox:c}),m.push(u)}const{sdfViewBox:c}=u,h=p[x++],g=p[x++],S=v/s;y[b++]=h+c[0]*S,y[b++]=g+c[1]*S,y[b++]=h+c[2]*S,y[b++]=g+c[3]*S,a[r]=u.atlasIndex})),g.quads=(g.quads||0)+(q()-S);const k=q();g.sdf={};const w=h.height,T=Math.ceil(f.glyphCount/u),_=Math.pow(2,Math.ceil(Math.log2(T*l)));_>w&&(console.info(`Increasing SDF texture size ${w}->${_}`),N(h,i,_),c.dispose()),Promise.all(m.map((e=>Y(e,f,t.gpuAccelerateSDF).then((({timing:t})=>{g.sdf[e.atlasIndex]=t}))))).then((()=>{m.length&&!f.contextLost&&(J(f),c.needsUpdate=!0),g.sdfTotal=q()-k,g.total=q()-n,r(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:l,sdfExponent:s,glyphBounds:y,glyphAtlasIndices:a,glyphColors:e.glyphColors,caretPositions:e.caretPositions,chunkedBounds:e.chunkedBounds,ascender:e.ascender,descender:e.descender,lineHeight:e.lineHeight,capHeight:e.capHeight,xHeight:e.xHeight,topBaseline:e.topBaseline,blockBounds:e.blockBounds,visibleBounds:e.visibleBounds,timings:e.timings}))}))})),Promise.resolve().then((()=>{var e;f.contextLost||(e=h)._warm||(M.webgl.isSupported(e),e._warm=!0)}))}function Y({path:e,atlasIndex:t,sdfViewBox:r},{sdfGlyphSize:n,sdfCanvas:a,contextLost:o},i){if(o)return Promise.resolve({timing:-1});const{textureWidth:s,sdfExponent:l}=V,u=Math.max(r[2]-r[0],r[3]-r[1]),f=Math.floor(t/4);return function(e,t,r,n,a,o,i,s,l,u,f=!0){return f?L(e,t,r,n,a,o,i,s,l,u).then(null,(f=>(I||(console.warn("WebGL SDF generation failed, falling back to JS",f),I=!0),z(e,t,r,n,a,o,i,s,l,u)))):z(e,t,r,n,a,o,i,s,l,u)}(n,n,e,r,u,l,a,f%(s/n)*n,Math.floor(f/(s/n))*n,t%4,i)}let Z;function K(e){return Z||(Z="undefined"==typeof document?{}:document.createElement("a")),Z.href=e,Z.href}function J(e){if("function"!=typeof createImageBitmap){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:t,sdfTexture:r}=e,{width:n,height:a}=t,o=e.sdfCanvas.getContext("webgl");let i=r.image.data;i&&i.length===n*a*4||(i=new Uint8Array(n*a*4),r.image={width:n,height:a,data:i},r.flipY=!1,r.isDataTexture=!0),o.readPixels(0,0,n,a,o.RGBA,o.UNSIGNED_BYTE,i)}}const Q=p({name:"Typesetter",dependencies:[function(e,t){const r=1/0,n=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,a="[^\\S\\u00A0]",o=new RegExp("[^\\S\\u00A0]|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]");function i({text:i="",font:c,lang:h="en",sdfGlyphSize:d=64,fontSize:p=400,fontWeight:v=1,fontStyle:g="normal",letterSpacing:m=0,lineHeight:y="normal",maxWidth:b=r,direction:x,textAlign:S="left",textIndent:U=0,whiteSpace:k="normal",overflowWrap:w="normal",anchorX:T=0,anchorY:_=0,metricsOnly:F=!1,unicodeFontsURL:C,preResolvedFonts:D=null,includeCaretPositions:A=!1,chunkedBoundsSize:O=8192,colorRanges:R=null},E){const M=u(),I={fontLoad:0,typesetting:0};i.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),i=i.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),p=+p,m=+m,b=+b,y=y||"normal",U=+U,function({text:t,lang:r,fonts:n,style:a,weight:o,preResolvedFonts:i,unicodeFontsURL:s},l){const u=({chars:e,fonts:t})=>{let r,n;const a=[];for(let o=0;o{I.fontLoad=u()-M;const c=isFinite(b);let h=null,d=null,v=null,g=null,C=null,D=null,P=null,B=null,G=0,L=0,W="nowrap"!==k;const j=new Map,z=u();let N=U,V=0,X=new f;const q=[X];e.forEach((e=>{const{fontObj:t}=e,{ascender:r,descender:s,unitsPerEm:l,lineGap:u,capHeight:h,xHeight:d}=t;let v=j.get(t);if(!v){const e=p/l,n="normal"===y?(r-s+u)*e:y*p,a=(n-(r-s)*e)/2,o=Math.min(n,(r-s)*e),i=(r+s)/2*e+o/2;v={index:j.size,src:t.src,fontObj:t,fontSizeMult:e,unitsPerEm:l,ascender:r*e,descender:s*e,capHeight:h*e,xHeight:d*e,lineHeight:n,baseline:-a-r*e,caretTop:(r+s)/2*e+o/2,caretBottom:i-o},j.set(t,v)}const{fontSizeMult:g}=v,x=i.slice(e.start,e.end+1);let S,k;t.forEachGlyph(x,p,m,((t,r,s)=>{r+=V,s+=e.start,S=r,k=t;const l=i.charAt(s),u=t.advanceWidth*g,h=X.count;let d;if("isEmpty"in t||(t.isWhitespace=!!l&&new RegExp(a).test(l),t.canBreakAfter=!!l&&o.test(l),t.isEmpty=t.xMin===t.xMax||t.yMin===t.yMax||n.test(l)),t.isWhitespace||t.isEmpty||L++,W&&c&&!t.isWhitespace&&r+u+N>b&&h){if(X.glyphAt(h-1).glyphObj.canBreakAfter)d=new f,N=-r;else for(let e=h;e--;){if(0===e&&"break-word"===w){d=new f,N=-r;break}if(X.glyphAt(e).glyphObj.canBreakAfter){d=X.splitAt(e+1);const t=d.glyphAt(0).x;N-=t;for(let e=d.count;e--;)d.glyphAt(e).x-=t;break}}d&&(X.isSoftWrapped=!0,X=d,q.push(X),G=b)}let y=X.glyphAt(X.count);y.glyphObj=t,y.x=r+N,y.width=u,y.charIndex=s,y.fontData=v,"\n"===l&&(X=new f,q.push(X),N=-(r+u+m*p)+U)})),V=S+k.advanceWidth*g+m*p}));let H=0;q.forEach((e=>{let t=!0;for(let r=e.count;r--;){const n=e.glyphAt(r);t&&!n.glyphObj.isWhitespace&&(e.width=n.x+n.width,e.width>G&&(G=e.width),t=!1);let{lineHeight:a,capHeight:o,xHeight:i,baseline:s}=n.fontData;a>e.lineHeight&&(e.lineHeight=a);const l=s-e.baseline;l<0&&(e.baseline+=l,e.cap+=l,e.ex+=l),e.cap=Math.max(e.cap,e.baseline+o),e.ex=Math.max(e.ex,e.baseline+i)}e.baseline-=H,e.cap-=H,e.ex-=H,H+=e.lineHeight}));let $=0,Y=0;if(T&&("number"==typeof T?$=-T:"string"==typeof T&&($=-G*("left"===T?0:"center"===T?.5:"right"===T?1:s(T)))),_&&("number"==typeof _?Y=-_:"string"==typeof _&&(Y="top"===_?0:"top-baseline"===_?-q[0].baseline:"top-cap"===_?-q[0].cap:"top-ex"===_?-q[0].ex:"middle"===_?H/2:"bottom"===_?H:"bottom-baseline"===_?q[q.length-1].baseline:s(_)*H)),!F){const e=t.getEmbeddingLevels(i,x);h=new Uint16Array(L),d=new Uint8Array(L),v=new Float32Array(2*L),g={},P=[r,r,-1/0,-1/0],B=[],A&&(D=new Float32Array(4*i.length)),R&&(C=new Uint8Array(3*L));let n,a,o=0,s=-1,u=-1;if(q.forEach(((f,c)=>{let{count:p,width:m}=f;if(p>0){let c=0;for(let e=p;e--&&f.glyphAt(e).glyphObj.isWhitespace;)c++;let y=0,b=0;if("center"===S)y=(G-m)/2;else if("right"===S)y=G-m;else if("justify"===S&&f.isSoftWrapped){let e=0;for(let t=p-c;t--;)f.glyphAt(t).glyphObj.isWhitespace&&e++;b=(G-m)/e}if(b||y){let e=0;for(let t=0;t=t){let t=e,o=e;for(;or)break;oU=e;for(let c=0;c1&&l(D,s,a),s=e}if(R){const{charIndex:e}=p;for(;e>u;)u++,R.hasOwnProperty(u)&&(a=R[u])}if(!U.isWhitespace&&!U.isEmpty){const e=o++,{fontSizeMult:t,src:i,index:s}=p.fontData,l=g[i]||(g[i]={});l[m]||(l[m]={path:U.path,pathBounds:[U.xMin,U.yMin,U.xMax,U.yMax]});const u=p.x+$,c=f.baseline+Y;v[2*e]=u,v[2*e+1]=c;const y=u+U.xMin*t,b=c+U.yMin*t,x=u+U.xMax*t,S=c+U.yMax*t;yP[2]&&(P[2]=x),S>P[3]&&(P[3]=S),e%O==0&&(n={start:e,end:e,rect:[r,r,-1/0,-1/0]},B.push(n)),n.end++;const k=n.rect;if(yk[2]&&(k[2]=x),S>k[3]&&(k[3]=S),h[e]=m,d[e]=s,R){const t=3*e;C[t]=a>>16&255,C[t+1]=a>>8&255,C[t+2]=255&a}}}}})),D){const e=i.length-s;e>1&&l(D,s,e)}}const Z=[];j.forEach((({index:e,src:t,unitsPerEm:r,ascender:n,descender:a,lineHeight:o,capHeight:i,xHeight:s})=>{Z[e]={src:t,unitsPerEm:r,ascender:n,descender:a,lineHeight:o,capHeight:i,xHeight:s}})),I.typesetting=u()-z,E({glyphIds:h,glyphFontIndices:d,glyphPositions:v,glyphData:g,fontData:Z,caretPositions:D,glyphColors:C,chunkedBounds:B,fontSize:p,topBaseline:Y+q[0].baseline,blockBounds:[$,Y-H,$+G,Y],visibleBounds:P,timings:I})}))}function s(e){let t=e.match(/^([\d.]+)%$/),r=t?parseFloat(t[1]):NaN;return isNaN(r)?0:r/100}function l(e,t,r){const n=e[4*t],a=e[4*t+1],o=e[4*t+2],i=e[4*t+3],s=(a-n)/r;for(let a=0;a(Object.defineProperty(e,t,{get(){return this.data[this.index*c.length+r]},set(e){this.data[this.index*c.length+r]=e}}),e)),{data:null,index:0}),{typeset:i,measure:function(e,t){i({...e,metricsOnly:!0},(e=>{const[r,n,a,o]=e.blockBounds;t({width:a-r,height:o-n})}))}}},R,function(){return function(e){var t={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},n={};r.L=1,n[1]="L",Object.keys(t).forEach((function(e,t){r[e]=1<"),u=l[0],f=l[1];u=String.fromCodePoint(n+=parseInt(u,36)),f=String.fromCodePoint(n+=parseInt(f,36)),a.set(u,f),t&&o.set(f,u)}})),{map:a,reverseMap:o}}function m(){if(!c){var e=g(p,!0),t=e.map,r=e.reverseMap;c=t,h=r,d=g(v,!1).map}}function y(e){return m(),c.get(e)||null}function b(e){return m(),h.get(e)||null}function x(e){return m(),d.get(e)||null}var S=r.L,U=r.R,k=r.EN,w=r.ES,T=r.ET,_=r.AN,F=r.CS,C=r.B,D=r.S,A=r.ON,O=r.BN,R=r.NSM,E=r.AL,M=r.LRO,I=r.RLO,P=r.LRE,B=r.RLE,G=r.PDF,L=r.LRI,W=r.RLI,j=r.FSI,z=r.PDI;var N;function V(e){return function(){if(!N){var e=g("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),t=e.map;e.reverseMap.forEach((function(e,r){t.set(r,e)})),N=t}}(),N.get(e)||null}function X(e,t,r,n){var a=e.length;r=Math.max(0,null==r?0:+r),n=Math.min(a-1,null==n?a-1:+n);var o=[];return t.paragraphs.forEach((function(a){var i=Math.max(r,a.start),s=Math.min(n,a.end);if(i=i&&f(e[c])&l;c--)u[c]=a.level;for(var h=a.level,d=1/0,p=0;ph&&(h=v),v=d;g--)for(var m=0;m=g){for(var y=m;m+1=g;)m++;m>y&&o.push([y+r,m+r])}}})),o}function q(e,t,r,n){for(var a=X(e,t,r,n),o=[],i=0;i0)$--;else if(Z>0){for(Y=0;!q[q.length-1]._isolate;)q.pop();var re=q[q.length-1]._isolInitIndex;null!=re&&(d.set(re,K),d.set(K,re)),q.pop(),Z--}H=q[q.length-1],h[K]=H._level,H._override&&c(K,H._override)}else J&G?(0===$&&(Y>0?Y--:!H._isolate&&q.length>1&&(q.pop(),H=q[q.length-1])),h[K]=H._level):J&C&&(h[K]=v.level);else h[K]=H._level,H._override&&J!==O&&c(K,H._override)}for(var ne=[],ae=null,oe=v.start;oe<=v.end;oe++){var ie=r[oe];if(!(ie&s)){var se=h[oe],le=ie&a,ue=ie===z;ae&&se===ae._level?(ae._end=oe,ae._endsWithIsolInit=le):ne.push(ae={_start:oe,_end:oe,_level:se,_startsWithPDI:ue,_endsWithIsolInit:le})}}for(var fe=[],ce=0;ce=0;Ue--)if(!(r[Ue]&s)){Se=h[Ue];break}var ke=ge[ge.length-1],we=h[ke],Te=v.level;if(!(r[ke]&a))for(var _e=ke+1;_e<=v.end;_e++)if(!(r[_e]&s)){Te=h[_e];break}fe.push({_seqIndices:ge,_sosType:Math.max(Se,xe)%2?U:S,_eosType:Math.max(Te,we)%2?U:S})}}for(var Fe=0;Fe=0;Ie--)if(!(r[De[Ie]]&s)){Me=r[De[Ie]];break}c(Ee,Me&(a|z)?A:Me)}}if(u.get(k))for(var Pe=0;Pe=-1;Ge--){var Le=-1===Ge?Ae:r[De[Ge]];if(Le&o){Le===E&&c(Be,_);break}}}if(u.get(E))for(var We=0;We=0&&(Ve=r[De[qe]])&s;qe--);for(var He=ze+1;He=0&&r[De[Ze]]&(T|s);Ze--)c(De[Ze],k);for(var Ke=$e+1;Ke=0&&r[De[et]]&s;et--)c(De[et],A);for(var tt=Je+1;tt=0;dt--){var pt=ut[dt].char;if(pt===ht||pt===b(x(ct))||y(x(pt))===ct){lt.push([ut[dt].seqIndex,ft]),ut.length=dt;break}}}lt.sort((function(e,t){return e[0]-t[0]}));for(var vt=0;vt=0;wt--){var Tt=De[wt];if(r[Tt]&st){var _t=r[Tt]&it?U:S;xt=_t!==Nt(Tt)?_t:Nt(Tt);break}}}if(xt){if(r[De[mt]]=r[De[yt]]=xt,xt!==Nt(De[mt]))for(var Ft=mt+1;Ft=0;Et--){if(!(r[De[Et]]&s)){Rt=r[De[Et]]&it?U:S;break}At=Et}for(var Mt=Oe,It=Dt+1;It=0&&f(e[Wt])&l;Wt--)h[Wt]=v.level}}return{levels:h,paragraphs:p};function jt(t,n){for(var o=t;oe(t,r())}),ee=p({name:"Typesetter",dependencies:[Q],init:e=>function(t){return new Promise((r=>{e.typeset(t,r)}))},getTransferables(e){const t=[];for(let r in e)e[r]&&e[r].buffer&&t.push(e[r].buffer);return t}}),te={};const re="aTroikaGlyphIndex";class ne extends e.InstancedBufferGeometry{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new e.Sphere,this.boundingBox=new e.Box3}computeBoundingSphere(){}computeBoundingBox(){}setSide(t){const r=this.getIndex().count;this.setDrawRange(t===e.BackSide?r/2:0,t===e.DoubleSide?r:r/2)}set detail(t){if(t!==this._detail){this._detail=t,("number"!=typeof t||t<1)&&(t=1);let r=function(t){let r=te[t];if(!r){const n=new e.PlaneGeometry(1,1,t,t),a=n.clone(),o=n.attributes,i=a.attributes,s=new e.BufferGeometry,l=o.uv.count;for(let e=0;e{s.setAttribute(t,new e.Float32BufferAttribute([...o[t].array,...i[t].array],o[t].itemSize))})),s.setIndex([...n.index.array,...a.index.array.map((e=>e+l))]),s.translate(.5,.5,0),r=te[t]=s}return r}(t);["position","normal","uv"].forEach((e=>{this.attributes[e]=r.attributes[e].clone()})),this.setIndex(r.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,r,n,a){ae(this,"aTroikaGlyphBounds",e,4),ae(this,re,t,1),ae(this,"aTroikaGlyphColor",a,3),this._blockBounds=r,this._chunkedBounds=n,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:r}=this;if(t){const{PI:n,floor:a,min:o,max:i,sin:s,cos:l}=Math,u=n/2,f=2*n,c=Math.abs(t),h=e[0]/c,d=e[2]/c,p=a((h+u)/f)!==a((d+u)/f)?-c:o(s(h)*c,s(d)*c),v=a((h-u)/f)!==a((d-u)/f)?c:i(s(h)*c,s(d)*c),g=a((h+n)/f)!==a((d+n)/f)?2*c:i(c-l(h)*c,c-l(d)*c);r.min.set(p,e[1],t<0?-g:0),r.max.set(v,e[3],t<0?0:g)}else r.min.set(e[0],e[1],0),r.max.set(e[2],e[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(re).count,r=this._chunkedBounds;if(r)for(let n=r.length;n--;){t=r[n].end;let a=r[n].rect;if(a[1]e.y&&a[0]e.x)break}this.instanceCount=t}}function ae(t,r,n,a){const o=t.getAttribute(r);n?o&&o.array.length===n.length?(o.array.set(n),o.needsUpdate=!0):(t.setAttribute(r,new e.InstancedBufferAttribute(n,a)),delete t._maxInstanceCount,t.dispose()):o&&t.deleteAttribute(r)}const oe=new e.MeshBasicMaterial({color:16777215,side:e.DoubleSide,transparent:!0}),ie=8421504,se=new e.Matrix4,le=new e.Vector3,ue=new e.Vector3,fe=[],ce=new e.Vector3,he="+x+y";function de(e){return Array.isArray(e)?e[0]:e}let pe=()=>{const t=new e.Mesh(new e.PlaneGeometry(1,1),oe);return pe=()=>t,t},ve=()=>{const t=new e.Mesh(new e.PlaneGeometry(1,1,32,1),oe);return ve=()=>t,t};const ge={type:"syncstart"},me={type:"synccomplete"},ye=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],be=ye.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class xe extends e.Mesh{constructor(){super(new ne,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang="en",this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=ie,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=he,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(ge),$({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},(t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync((()=>{r.forEach((e=>e&&e()))}))),this.dispatchEvent(me),e&&e()}))))}onBeforeRender(t,r,n,a,o,i){this.sync(),o.isTroikaTextMaterial&&this._prepareForRender(o),o._hadOwnSide=o.hasOwnProperty("side"),this.geometry.setSide(o._actualSide=o.side),o.side=e.FrontSide}onAfterRender(e,t,r,n,a,o){a._hadOwnSide?a.side=a._actualSide:delete a.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let t=this._derivedMaterial;const r=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=oe.clone());if(t&&t.baseMaterial===r||(t=this._derivedMaterial=function(t){const r=_(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new e.Vector2},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new e.Vector4(0,0,0,0)},uTroikaClipRect:{value:new e.Vector4(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new e.Vector2},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new e.Color},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new e.Matrix3},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nuniform vec4 uTroikaClipRect;\nuniform mat3 uTroikaOrient;\nuniform bool uTroikaUseGlyphColors;\nuniform float uTroikaDistanceOffset;\nuniform float uTroikaBlurRadius;\nuniform vec2 uTroikaPositionOffset;\nuniform float uTroikaCurveRadius;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nattribute vec3 aTroikaGlyphColor;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec3 vTroikaGlyphColor;\nvarying vec2 vTroikaGlyphDimensions;\n",vertexTransform:"\nvec4 bounds = aTroikaGlyphBounds;\nbounds.xz += uTroikaPositionOffset.x;\nbounds.yw -= uTroikaPositionOffset.y;\n\nvec4 outlineBounds = vec4(\n bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius,\n bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius\n);\nvec4 clippedBounds = vec4(\n clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),\n clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)\n);\n\nvec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);\n\nposition.xy = mix(bounds.xy, bounds.zw, clippedXY);\n\nuv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);\n\nfloat rad = uTroikaCurveRadius;\nif (rad != 0.0) {\n float angle = position.x / rad;\n position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);\n normal.xz = vec2(sin(angle), cos(angle));\n}\n \nposition = uTroikaOrient * position;\nnormal = uTroikaOrient * normal;\n\nvTroikaGlyphUV = clippedXY.xy;\nvTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);\n\n\nfloat txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;\nvec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;\nvec2 txStartUV = txUvPerSquare * vec2(\n mod(floor(aTroikaGlyphIndex / 4.0), txCols),\n floor(floor(aTroikaGlyphIndex / 4.0) / txCols)\n);\nvTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);\nvTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);\n",fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform float uTroikaSDFExponent;\nuniform float uTroikaDistanceOffset;\nuniform float uTroikaFillOpacity;\nuniform float uTroikaOutlineOpacity;\nuniform float uTroikaBlurRadius;\nuniform vec3 uTroikaStrokeColor;\nuniform float uTroikaStrokeWidth;\nuniform float uTroikaStrokeOpacity;\nuniform bool uTroikaSDFDebug;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec2 vTroikaGlyphDimensions;\n\nfloat troikaSdfValueToSignedDistance(float alpha) {\n // Inverse of exponential encoding in webgl-sdf-generator\n \n float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);\n float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;\n float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);\n return signedDist;\n}\n\nfloat troikaGlyphUvToSdfValue(vec2 glyphUV) {\n vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);\n vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);\n float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1\n return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;\n}\n\nfloat troikaGlyphUvToDistance(vec2 uv) {\n return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));\n}\n\nfloat troikaGetAADist() {\n \n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;\n #else\n return vTroikaGlyphDimensions.x / 64.0;\n #endif\n}\n\nfloat troikaGetFragDistValue() {\n vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);\n float distance = troikaGlyphUvToDistance(clampedGlyphUV);\n \n // Extrapolate distance when outside bounds:\n distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : \n length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);\n\n \n\n return distance;\n}\n\nfloat troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {\n #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\n float alpha = step(-distanceOffset, -distance);\n #else\n\n float alpha = smoothstep(\n distanceOffset + aaDist,\n distanceOffset - aaDist,\n distance\n );\n #endif\n\n return alpha;\n}\n",fragmentColorTransform:"\nfloat aaDist = troikaGetAADist();\nfloat fragDistance = troikaGetFragDistValue();\nfloat edgeAlpha = uTroikaSDFDebug ?\n troikaGlyphUvToSdfValue(vTroikaGlyphUV) :\n troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius));\n\n#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)\nvec4 fillRGBA = gl_FragColor;\nfillRGBA.a *= uTroikaFillOpacity;\nvec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);\nif (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;\ngl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(\n -uTroikaStrokeWidth - aaDist,\n -uTroikaStrokeWidth + aaDist,\n fragDistance\n));\ngl_FragColor.a *= edgeAlpha;\n#endif\n\nif (edgeAlpha == 0.0) {\n discard;\n}\n",customRewriter({vertexShader:e,fragmentShader:t}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(t)&&(t=t.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(e)||(e=e.replace(y,"uniform vec3 diffuse;\n$&\nvTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;\n"))),{vertexShader:e,fragmentShader:t}}});return r.transparent=!0,Object.defineProperties(r,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),r}(r),r.addEventListener("dispose",(function e(){r.removeEventListener("dispose",e),t.dispose()}))),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let e=t._outlineMtl;return e||(e=t._outlineMtl=Object.create(t,{id:{value:t.id+.1}}),e.isTextOutlineMaterial=!0,e.depthWrite=!1,e.map=null,t.addEventListener("dispose",(function r(){t.removeEventListener("dispose",r),e.dispose()}))),[e,t]}return t}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return de(this.material).getDepthMaterial()}get customDistanceMaterial(){return de(this.material).getDistanceMaterial()}_prepareForRender(t){const r=t.isTextOutlineMaterial,n=t.uniforms,a=this.textRenderInfo;if(a){const{sdfTexture:e,blockBounds:t}=a;n.uTroikaSDFTexture.value=e,n.uTroikaSDFTextureSize.value.set(e.image.width,e.image.height),n.uTroikaSDFGlyphSize.value=a.sdfGlyphSize,n.uTroikaSDFExponent.value=a.sdfExponent,n.uTroikaTotalBounds.value.fromArray(t),n.uTroikaUseGlyphColors.value=!r&&!!a.glyphColors;let o,i,s,l=0,u=0,f=0,c=0,h=0;if(r){let{outlineWidth:e,outlineOffsetX:t,outlineOffsetY:r,outlineBlur:n,outlineOpacity:a}=this;l=this._parsePercent(e)||0,u=Math.max(0,this._parsePercent(n)||0),o=a,c=this._parsePercent(t)||0,h=this._parsePercent(r)||0}else f=Math.max(0,this._parsePercent(this.strokeWidth)||0),f&&(s=this.strokeColor,n.uTroikaStrokeColor.value.set(null==s?ie:s),i=this.strokeOpacity,null==i&&(i=1)),o=this.fillOpacity;n.uTroikaDistanceOffset.value=l,n.uTroikaPositionOffset.value.set(c,h),n.uTroikaBlurRadius.value=u,n.uTroikaStrokeWidth.value=f,n.uTroikaStrokeOpacity.value=i,n.uTroikaFillOpacity.value=null==o?1:o,n.uTroikaCurveRadius.value=this.curveRadius||0;let d=this.clipRect;if(d&&Array.isArray(d)&&4===d.length)n.uTroikaClipRect.value.fromArray(d);else{const e=100*(this.fontSize||.1);n.uTroikaClipRect.value.set(t[0]-e,t[1]-e,t[2]+e,t[3]+e)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,t.polygonOffset=!!this.depthOffset,t.polygonOffsetFactor=t.polygonOffsetUnits=this.depthOffset||0;const o=r?this.outlineColor||0:this.color;if(null==o)delete t.color;else{const r=t.hasOwnProperty("color")?t.color:t.color=new e.Color;o===r._input&&"object"!=typeof o||r.set(r._input=o)}let i=this.orientation||he;if(i!==t._orientation){let e=n.uTroikaOrient.value;i=i.replace(/[^-+xyz]/g,"");let r=i!==he&&i.match(/^([-+])([xyz])([-+])([xyz])$/);if(r){let[,t,n,a,o]=r;le.set(0,0,0)[n]="-"===t?1:-1,ue.set(0,0,0)[o]="-"===a?-1:1,se.lookAt(ce,le.cross(ue),ue),e.setFromMatrix4(se)}else e.identity();t._orientation=i}}_parsePercent(e){if("string"==typeof e){let t=e.match(/^(-?[\d.]+)%$/),r=t?parseFloat(t[1]):NaN;e=(isNaN(r)?0:r/100)*this.fontSize}return e}localPositionToTextCoords(t,r=new e.Vector2){r.copy(t);const n=this.curveRadius;return n&&(r.x=Math.atan2(t.x,Math.abs(n)-Math.abs(t.z))*Math.abs(n)),r}worldPositionToTextCoords(t,r=new e.Vector2){return le.copy(t),this.localPositionToTextCoords(this.worldToLocal(le),r)}raycast(e,t){const{textRenderInfo:r,curveRadius:n}=this;if(r){const a=r.blockBounds,o=n?ve():pe(),i=o.geometry,{position:s,uv:l}=i.attributes;for(let e=0;e{this[t]=e[t]})),this}clone(){return(new this.constructor).copy(this)}}ye.forEach((e=>{const t="_private_"+e;Object.defineProperty(xe.prototype,e,{get(){return this[t]},set(e){e!==this[t]&&(this[t]=e,this._needsSync=!0)}})}));var Se="troika-text";function Ue(e){return{default:e,parse:function(e){return"string"==typeof e&&e.indexOf("%")>0?e:(e=+e,isNaN(e)?0:e)},stringify:function(e){return""+e}}}o.default.registerComponent(Se,{schema:{align:{type:"string",default:"left",oneOf:["left","right","center","justify"]},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},clipRect:{type:"string",default:"",parse:function(e){return e&&(e=e.split(/[\s,]+/).reduce((function(e,t){return t=+t,isNaN(t)||e.push(t),e}),[])),e&&4===e.length?e:null},stringify:function(e){return e?e.join(" "):""}},color:{type:"color",default:"#FFF"},colorRanges:{type:"string",default:null,parse:function(e){return"string"==typeof e?JSON.parse(e):e},stringify:JSON.stringify},curveRadius:{type:"number",default:0},depthOffset:{type:"number",default:0},direction:{type:"string",default:"auto",oneOf:["auto","ltr","rtl"]},fillOpacity:{type:"number",default:1},font:{type:"string"},fontSize:{type:"number",default:.2},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},maxWidth:{type:"number",default:1/0},outlineBlur:Ue(0),outlineColor:{type:"color",default:"#000"},outlineOffsetX:Ue(0),outlineOffsetY:Ue(0),outlineOpacity:{type:"number",default:1},outlineWidth:Ue(0),overflowWrap:{type:"string",default:"normal",oneOf:["normal","break-word"]},strokeColor:{type:"color",default:"grey"},strokeOpacity:{type:"number",default:1},strokeWidth:Ue(0),textIndent:{type:"number",default:0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","nowrap"]}},init:function(){var e;"a-troika-text"===this.el.tagName.toLowerCase()?e=this.el:(e=document.createElement("a-entity"),this.el.appendChild(e)),this.troikaTextEntity=e;var t=this.troikaTextMesh=new xe;e.setObject3D("mesh",t)},update:function(){var e=this.data,t=this.troikaTextMesh,r=this.troikaTextEntity,n=e.font;if(t.text=(e.value||"").replace(/\\n/g,"\n").replace(/\\t/g,"\t"),t.textAlign=e.align,e.font.startsWith("#")){n=document.querySelector(e.font).getAttribute("src")}if(t.anchorX=we["align"===e.anchor?e.align:e.anchor]||"center",t.anchorY=Te[e.baseline]||"middle",t.color=e.color,t.colorRanges=e.colorRanges,t.clipRect=e.clipRect,t.curveRadius=e.curveRadius,t.depthOffset=e.depthOffset||0,t.direction=e.direction,t.fillOpacity=e.fillOpacity,t.font=n,t.fontSize=e.fontSize,t.letterSpacing=e.letterSpacing||0,t.lineHeight=e.lineHeight||"normal",t.outlineBlur=e.outlineBlur,t.outlineColor=e.outlineColor,t.outlineOffsetX=e.outlineOffsetX,t.outlineOffsetY=e.outlineOffsetY,t.outlineOpacity=e.outlineOpacity,t.outlineWidth=e.outlineWidth,t.overflowWrap=e.overflowWrap,t.strokeColor=e.strokeColor,t.strokeOpacity=e.strokeOpacity,t.strokeWidth=e.strokeWidth,t.textIndent=e.textIndent,t.whiteSpace=e.whiteSpace,t.maxWidth=e.maxWidth,t.sync(),r!==this.el){var a=this.el.getAttribute("troika-text-material");a?r.setAttribute("material",a):r.removeAttribute("material")}},remove:function(){this.troikaTextMesh.dispose(),this.troikaTextEntity!==this.el&&this.el.removeChild(this.troikaTextEntity)}});var ke,we={left:"left",center:"center",right:"right"},Te={top:"top",center:"middle",bottom:"bottom"},_e={},Fe=o.default.components["troika-text"].schema;Object.keys(Fe).map((function(e){var t=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();_e[t]="troika-text."+e})),o.default.registerPrimitive("a-troika-text",{defaultComponents:{"troika-text":{}},mappings:_e}),(ke=a).MathUtils||(ke.MathUtils=ke.Math)}(THREE,AFRAME); +//# sourceMappingURL=aframe-troika-text.min.js.map diff --git a/dist/xrfragment.aframe.all.js b/dist/xrfragment.aframe.all.js index 8974f52..8860aa5 100644 --- a/dist/xrfragment.aframe.all.js +++ b/dist/xrfragment.aframe.all.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Apr 16 04:44:21 PM UTC 2024 + * v0.5.1 generated at Thu Apr 25 03:56:52 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -1945,6 +1945,7 @@ xrf.parseModel = function(model,url){ let file = xrf.getFile(url) model.file = file model.isXRF = true + model.scene.isXRFRoot = true model.scene.traverse( (n) => n.isXRF = true ) // mark for deletion during reset() xrf.emit('parseModel',{model,url,file}) @@ -2017,10 +2018,12 @@ xrf.navigator.to = (url,flags,loader,data) => { let URI = xrfragment.URI.toAbsolute( xrf.navigator.URI, url ) URI.hash = xrf.navigator.reactifyHash(URI.hash) - let fileChange = URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file - let external = URI.URN != document.location.origin + document.location.pathname - let hasPos = URI.hash.pos - let hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") + // decorate with extra state + URI.fileChange = URI.file && URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file + URI.external = URI.file && URI.URN != document.location.origin + document.location.pathname + URI.hasPos = URI.hash.pos ? true : false + URI.duplicatePos = URI.source == xrf.navigator.URI.source && URI.hasPos + URI.hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") let hashbus = xrf.hashbus xrf.navigator.URI = URI let {directory,file,fragment,fileExt} = URI; @@ -2044,22 +2047,25 @@ xrf.navigator.to = (url,flags,loader,data) => { loader = loader || new Loader().setPath( URI.URN ) } - if( !URI.fragment && !URI.file && !URI.fileExt ) return resolve(xrf.model) // nothing we can do here - if( xrf.model && !fileChange && hashChange && !hasPos ){ + if( URI.duplicatePos || (!URI.fragment && !URI.file && !URI.fileExt) ){ + return resolve(xrf.model) // nothing we can do here + } + + if( xrf.model && !URI.fileChange && URI.hashChange && !URI.hasPos ){ evalFragment() - return resolve(xrf.model) // positional navigation + return resolve(xrf.model) // eval non-positional fragments (no loader needed) } xrf .emit('navigateLoading', {url,loader,data}) .then( () => { - if( (!fileChange || !file) && hashChange && hasPos ){ // we're already loaded + if( (!URI.fileChange || !file) && URI.hashChange && URI.hasPos ){ // we're already loaded evalFragment() xrf.emit('navigateLoaded',{url}) return resolve(xrf.model) } - + // clear xrf objects from scene if( xrf.model && xrf.model.scene ) xrf.model.scene.visible = false xrf.reset() @@ -2071,11 +2077,6 @@ xrf.navigator.to = (url,flags,loader,data) => { const onLoad = (model) => { model.file = URI.file - // only change url when loading *another* file - if( xrf.model ){ - xrf.navigator.pushState( external ? URI.URN + URI.file : URI.file, fragment ) - } - //if( xrf.model ) xrf.navigator.pushState( `${ document.location.pathname != URI.directory ? URI.directory: ''}${URI.file}`, fragment ) xrf.model = model if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model @@ -2090,12 +2091,17 @@ xrf.navigator.to = (url,flags,loader,data) => { model.scene.traverse( (mesh) => xrf.parseModel.metadataInMesh(mesh,model) ) } // spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view) - xrf.frag.defaultPredefinedViews({model,scene:model.scene}) + const defaultFragment = xrf.frag.defaultPredefinedViews({model,scene:model.scene}) // spec: predefined view(s) & objects-of-interest-in-XRWG from URI (https://xrfragment.org/#predefined_view) let frag = xrf.hashbus.pub( url, model) // and eval URI XR fragments - + xrf.add( model.scene ) - if( fragment ) xrf.navigator.updateHash(fragment) + + // only change url when loading *another* file + fragment = fragment || defaultFragment || '' + xrf.navigator.pushState( URI.external ? URI.URN + URI.file : URI.file, fragment.replace(/^#/,'') ) + //if( fragment ) xrf.navigator.updateHash(fragment) + xrf.emit('navigateLoaded',{url,model}) resolve(model) } @@ -2122,7 +2128,7 @@ xrf.navigator.init = () => { window.addEventListener('popstate', function (event){ if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) - xrf.navigator.to( document.location.href.replace(/\?/,'') ) + xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) } }) @@ -2358,13 +2364,16 @@ xrf.addEventListener('audioInited', function(opts){ xrf.frag.defaultPredefinedViews = (opts) => { let {scene,model} = opts; + let defaultFragment; scene.traverse( (n) => { if( n.userData && n.userData['#'] ){ - if( !n.parent && !document.location.hash ){ - xrf.navigator.to( n.userData['#'] ) - }else xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL + if( n.isXRFRoot ){ + defaultFragment = n.userData['#'] + } + xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL } }) + return defaultFragment } xrf.frag.loop = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -2404,7 +2413,7 @@ xrf.frag.pos = function(v, opts){ if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) - xrf.frag.pos.last = pos // remember + xrf.frag.pos.last = v.string // remember camera.updateMatrixWorld() } @@ -3148,6 +3157,17 @@ xrf.optimize.removeDuplicateLights = () => { xrf.addEventListener('parseModel', (opts) => { xrf.optimize(opts) }) +xrf.sceneToTranscript = (scene, ignoreMesh ) => { + let transcript = '' + scene.traverse( (n) => { + let isSRC = false + n.traverseAncestors( (m) => m.userData.src ? isSRC = true : false ) + if( !isSRC && n.userData['aria-description'] && (!ignoreMesh || n.uuid != ignoreMesh.uuid) ){ + transcript += `#${n.name} ${n.userData['aria-description']}. ` + } + }) + return transcript +} // switch camera when multiple cameras for url #mycameraname xrf.addEventListener('dynamicKey', (opts) => { @@ -4098,10 +4118,16 @@ window.AFRAME.registerComponent('xrf', { VRbutton = document.querySelector('.a-enter-vr-button') if( ARbutton ) ARbutton.addEventListener('click', () => AFRAME.XRF.hashbus.pub( '#-VR' ) ) if( VRbutton ) VRbutton.addEventListener('click', () => AFRAME.XRF.hashbus.pub( '#VR' ) ) - //if( AFRAME.utils.device.checkARSupport() && VRbutton ){ - // VRbutton.style.display = 'none' - // ARbutton.parentNode.style.right = '20px' - //} + }) + + // (de)active look-controls because of 'rot=' XR Fragment + aScene.addEventListener('loaded', () => { + // this is just for convenience (not part of spec): enforce AR + hide/show stuff based on VR tags in 3D model + aScene.canvas.addEventListener('mousedown', () => xrf.camera.el.setAttribute("look-controls","") ) + }) + XRF.addEventListener('rot',(e) => { + let lookcontrols = document.querySelector('[look-controls]') + if( lookcontrols ) lookcontrols.removeAttribute("look-controls") }) let repositionUser = (scale) => () => { diff --git a/dist/xrfragment.aframe.js b/dist/xrfragment.aframe.js index 508f321..2ee9e95 100644 --- a/dist/xrfragment.aframe.js +++ b/dist/xrfragment.aframe.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Apr 16 04:44:20 PM UTC 2024 + * v0.5.1 generated at Thu Apr 25 03:56:52 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -1943,6 +1943,7 @@ xrf.parseModel = function(model,url){ let file = xrf.getFile(url) model.file = file model.isXRF = true + model.scene.isXRFRoot = true model.scene.traverse( (n) => n.isXRF = true ) // mark for deletion during reset() xrf.emit('parseModel',{model,url,file}) @@ -2015,10 +2016,12 @@ xrf.navigator.to = (url,flags,loader,data) => { let URI = xrfragment.URI.toAbsolute( xrf.navigator.URI, url ) URI.hash = xrf.navigator.reactifyHash(URI.hash) - let fileChange = URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file - let external = URI.URN != document.location.origin + document.location.pathname - let hasPos = URI.hash.pos - let hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") + // decorate with extra state + URI.fileChange = URI.file && URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file + URI.external = URI.file && URI.URN != document.location.origin + document.location.pathname + URI.hasPos = URI.hash.pos ? true : false + URI.duplicatePos = URI.source == xrf.navigator.URI.source && URI.hasPos + URI.hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") let hashbus = xrf.hashbus xrf.navigator.URI = URI let {directory,file,fragment,fileExt} = URI; @@ -2042,22 +2045,25 @@ xrf.navigator.to = (url,flags,loader,data) => { loader = loader || new Loader().setPath( URI.URN ) } - if( !URI.fragment && !URI.file && !URI.fileExt ) return resolve(xrf.model) // nothing we can do here - if( xrf.model && !fileChange && hashChange && !hasPos ){ + if( URI.duplicatePos || (!URI.fragment && !URI.file && !URI.fileExt) ){ + return resolve(xrf.model) // nothing we can do here + } + + if( xrf.model && !URI.fileChange && URI.hashChange && !URI.hasPos ){ evalFragment() - return resolve(xrf.model) // positional navigation + return resolve(xrf.model) // eval non-positional fragments (no loader needed) } xrf .emit('navigateLoading', {url,loader,data}) .then( () => { - if( (!fileChange || !file) && hashChange && hasPos ){ // we're already loaded + if( (!URI.fileChange || !file) && URI.hashChange && URI.hasPos ){ // we're already loaded evalFragment() xrf.emit('navigateLoaded',{url}) return resolve(xrf.model) } - + // clear xrf objects from scene if( xrf.model && xrf.model.scene ) xrf.model.scene.visible = false xrf.reset() @@ -2069,11 +2075,6 @@ xrf.navigator.to = (url,flags,loader,data) => { const onLoad = (model) => { model.file = URI.file - // only change url when loading *another* file - if( xrf.model ){ - xrf.navigator.pushState( external ? URI.URN + URI.file : URI.file, fragment ) - } - //if( xrf.model ) xrf.navigator.pushState( `${ document.location.pathname != URI.directory ? URI.directory: ''}${URI.file}`, fragment ) xrf.model = model if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model @@ -2088,12 +2089,17 @@ xrf.navigator.to = (url,flags,loader,data) => { model.scene.traverse( (mesh) => xrf.parseModel.metadataInMesh(mesh,model) ) } // spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view) - xrf.frag.defaultPredefinedViews({model,scene:model.scene}) + const defaultFragment = xrf.frag.defaultPredefinedViews({model,scene:model.scene}) // spec: predefined view(s) & objects-of-interest-in-XRWG from URI (https://xrfragment.org/#predefined_view) let frag = xrf.hashbus.pub( url, model) // and eval URI XR fragments - + xrf.add( model.scene ) - if( fragment ) xrf.navigator.updateHash(fragment) + + // only change url when loading *another* file + fragment = fragment || defaultFragment || '' + xrf.navigator.pushState( URI.external ? URI.URN + URI.file : URI.file, fragment.replace(/^#/,'') ) + //if( fragment ) xrf.navigator.updateHash(fragment) + xrf.emit('navigateLoaded',{url,model}) resolve(model) } @@ -2120,7 +2126,7 @@ xrf.navigator.init = () => { window.addEventListener('popstate', function (event){ if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) - xrf.navigator.to( document.location.href.replace(/\?/,'') ) + xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) } }) @@ -2356,13 +2362,16 @@ xrf.addEventListener('audioInited', function(opts){ xrf.frag.defaultPredefinedViews = (opts) => { let {scene,model} = opts; + let defaultFragment; scene.traverse( (n) => { if( n.userData && n.userData['#'] ){ - if( !n.parent && !document.location.hash ){ - xrf.navigator.to( n.userData['#'] ) - }else xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL + if( n.isXRFRoot ){ + defaultFragment = n.userData['#'] + } + xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL } }) + return defaultFragment } xrf.frag.loop = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -2402,7 +2411,7 @@ xrf.frag.pos = function(v, opts){ if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) - xrf.frag.pos.last = pos // remember + xrf.frag.pos.last = v.string // remember camera.updateMatrixWorld() } @@ -3146,6 +3155,17 @@ xrf.optimize.removeDuplicateLights = () => { xrf.addEventListener('parseModel', (opts) => { xrf.optimize(opts) }) +xrf.sceneToTranscript = (scene, ignoreMesh ) => { + let transcript = '' + scene.traverse( (n) => { + let isSRC = false + n.traverseAncestors( (m) => m.userData.src ? isSRC = true : false ) + if( !isSRC && n.userData['aria-description'] && (!ignoreMesh || n.uuid != ignoreMesh.uuid) ){ + transcript += `#${n.name} ${n.userData['aria-description']}. ` + } + }) + return transcript +} // switch camera when multiple cameras for url #mycameraname xrf.addEventListener('dynamicKey', (opts) => { @@ -4096,10 +4116,16 @@ window.AFRAME.registerComponent('xrf', { VRbutton = document.querySelector('.a-enter-vr-button') if( ARbutton ) ARbutton.addEventListener('click', () => AFRAME.XRF.hashbus.pub( '#-VR' ) ) if( VRbutton ) VRbutton.addEventListener('click', () => AFRAME.XRF.hashbus.pub( '#VR' ) ) - //if( AFRAME.utils.device.checkARSupport() && VRbutton ){ - // VRbutton.style.display = 'none' - // ARbutton.parentNode.style.right = '20px' - //} + }) + + // (de)active look-controls because of 'rot=' XR Fragment + aScene.addEventListener('loaded', () => { + // this is just for convenience (not part of spec): enforce AR + hide/show stuff based on VR tags in 3D model + aScene.canvas.addEventListener('mousedown', () => xrf.camera.el.setAttribute("look-controls","") ) + }) + XRF.addEventListener('rot',(e) => { + let lookcontrols = document.querySelector('[look-controls]') + if( lookcontrols ) lookcontrols.removeAttribute("look-controls") }) let repositionUser = (scale) => () => { diff --git a/dist/xrfragment.module.js b/dist/xrfragment.module.js index 42aba88..12320b3 100644 --- a/dist/xrfragment.module.js +++ b/dist/xrfragment.module.js @@ -1,3 +1,1388 @@ +/* + * v0.5.1 generated at Thu Apr 25 03:56:52 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 03:51:23 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 03:48:25 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 03:46:59 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 03:46:49 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 03:46:41 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 03:45:49 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 03:45:37 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:59:23 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:58:43 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:58:39 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:57:25 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:56:01 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:55:45 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:52:45 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:36:16 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:35:07 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:33:19 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:31:34 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:30:25 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:28:01 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:27:36 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:27:26 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:21:22 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:19:29 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:18:55 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:13:37 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:13:12 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:12:57 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:12:44 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:11:08 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:10:40 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:10:06 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:06:50 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:06:10 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:05:52 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 02:02:46 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:55:13 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:53:38 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:41:24 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:41:00 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:40:55 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:40:28 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:36:04 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:35:15 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:33:26 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:32:11 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:22:15 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:22:08 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:21:32 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:21:01 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:20:56 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:19:32 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 11:18:58 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 10:21:20 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Thu Apr 25 10:20:49 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 04:02:45 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 04:01:26 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 04:01:22 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 04:00:37 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:59:56 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:59:24 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:58:28 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:58:13 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:56:38 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:50:17 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:49:35 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:47:32 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:47:25 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:41:39 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:41:34 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:37:51 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:37:06 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:35:13 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:24:01 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:23:31 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:22:26 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:17:06 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:13:14 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:13:03 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:12:58 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:11:38 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:10:01 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:09:26 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:08:02 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 03:03:14 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:58:57 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:54:13 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:48:17 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:47:00 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:32:36 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:30:09 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:22:39 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:16:25 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:15:48 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:14:16 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:11:37 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:06:52 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:03:51 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:02:17 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 02:00:18 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:59:21 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:58:18 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:56:28 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:56:12 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:55:57 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:55:46 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:54:50 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:54:41 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:53:39 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:52:45 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:52:17 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:52:10 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:48:20 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:47:11 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:47:07 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:46:24 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:40:23 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:38:20 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:36:23 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:36:05 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:35:17 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:33:51 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:31:50 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:30:01 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:29:40 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:29:25 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:22:47 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:14:57 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:07:22 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:06:54 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 01:06:39 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 12:57:02 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 12:55:21 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 12:47:13 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 12:45:40 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 12:21:17 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 12:20:47 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 12:20:38 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 12:20:34 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:49:03 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:48:45 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:48:19 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:09:48 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:07:39 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:07:28 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:07:18 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:06:52 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:06:18 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:06:02 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:04:28 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:04:11 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:03:18 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 11:02:05 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:56:38 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:54:41 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:54:22 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:51:40 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:51:11 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:49:45 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:49:31 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:49:15 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:48:14 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:47:29 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:41:15 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:40:32 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:30:04 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:29:42 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:29:35 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:29:25 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 24 10:28:19 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:41:54 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:41:34 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:40:59 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:39:47 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:37:35 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:36:38 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:35:51 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:35:29 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:33:17 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:33:04 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:32:23 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:31:46 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:31:15 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:30:56 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:30:51 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:29:55 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:29:53 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:29:20 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:26:38 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:26:04 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:25:46 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:25:26 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:24:07 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:23:40 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:23:18 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:21:12 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:20:12 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:17:14 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:16:18 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:15:55 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:14:31 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:13:17 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:12:34 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:08:29 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:07:16 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:03:20 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 09:02:38 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:59:52 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:52:50 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:48:30 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:48:27 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:46:31 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:46:04 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:44:21 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:40:54 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:40:28 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:39:43 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:38:20 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 08:36:22 AM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 23 10:22:49 AM CEST 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Mon Apr 22 02:00:23 PM CEST 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Mon Apr 22 01:59:23 PM CEST 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 03:19:38 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:56:00 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:55:41 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:55:01 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:50:33 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:48:37 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:46:17 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:42:10 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:40:21 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:39:23 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:38:53 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:35:46 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:35:39 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:34:38 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:34:18 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:33:00 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:18:43 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:18:39 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:17:59 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:16:46 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:16:07 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:15:54 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:14:37 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:14:24 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:14:00 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:13:14 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:08:29 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:06:13 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:06:08 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 02:04:04 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 01:22:12 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:32:41 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:32:38 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:30:16 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:30:05 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:27:18 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:21:32 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:21:14 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:20:39 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:20:33 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:20:25 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:20:02 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:18:49 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:18:06 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:17:10 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:16:19 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:11:21 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:10:18 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:10:08 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:09:55 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Wed Apr 17 12:08:37 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 16 05:52:11 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 16 05:49:01 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ +/* + * v0.5.1 generated at Tue Apr 16 05:48:04 PM UTC 2024 + * https://xrfragment.org + * SPDX-License-Identifier: MPL-2.0 + */ /* * v0.5.1 generated at Tue Apr 16 04:44:20 PM UTC 2024 * https://xrfragment.org @@ -1575,3 +2960,435447 @@ xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); })(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); var xrfragment = $hx_exports["xrfragment"]; export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g1_key = _g_offset; + var _g1_value = _g_s.charCodeAt(_g_offset++); + var i = _g1_key; + var c = _g1_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown(""); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; diff --git a/dist/xrfragment.plugin.frontend.css.js b/dist/xrfragment.plugin.frontend.css.js index 4f803ba..c38ec23 100644 --- a/dist/xrfragment.plugin.frontend.css.js +++ b/dist/xrfragment.plugin.frontend.css.js @@ -289,7 +289,7 @@ document.head.innerHTML += ` } .badge, - #messages .msg.ui div.badge{ + #messages .msg .badge{ box-sizing:border-box; display:inline-block; color: var(--xrf-white); @@ -304,6 +304,11 @@ document.head.innerHTML += ` #messages .msg.ui div.badge a{ color:#FFF; } + #messages .msg .badge{ + display:inline; + color: var(--xrf-primary-fg); + background: var(--xrf-dark-gray); + } .ruler{ width:97%; @@ -364,8 +369,8 @@ document.head.innerHTML += ` } .transcript{ - max-height:105px; - max-width:405px; + max-height:132px; + width:100%; overflow-y:auto; border: 1px solid var(--xrf-gray); border-radius: 5px; diff --git a/dist/xrfragment.plugin.frontend.js b/dist/xrfragment.plugin.frontend.js index 039b0ce..45016a6 100644 --- a/dist/xrfragment.plugin.frontend.js +++ b/dist/xrfragment.plugin.frontend.js @@ -255,14 +255,15 @@ window.accessibility = (opts) => new Proxy({ enabled: false, // features - speak_movements: true, - speak_keyboard: true, + speak_teleports: true, + speak_keyboard: false, // audio settings speak_rate: 1, speak_pitch: 1, speak_volume: 1, speak_voice: -1, + speak_voices: 0, toggle(){ this.enabled = !this.enabled }, @@ -284,8 +285,10 @@ window.accessibility = (opts) => new Proxy({ } let speech = window.speechSynthesis let utterance = new SpeechSynthesisUtterance( str ) - if( this.speak_voice != -1) utterance.voice = speech.getVoices()[ this.speak_voice ]; - else{ + this.speak_voices = speech.getVoices().length + if( this.speak_voice != -1 && this.speak_voice < this.speak_voices ){ + utterance.voice = speech.getVoices()[ this.speak_voice ]; + }else{ let voices = speech.getVoices() for(let i = 0; i < voices.length; i++ ){ if( voices[i].lang == navigator.lang ) this.speak_voice = i; @@ -329,6 +332,9 @@ window.accessibility = (opts) => new Proxy({ this.speak( lines.join("."), {override:true,speaksigns:false} ) } }) + document.addEventListener('$chat.send', (opts) => { + if( opts.detail.message ) this.speak( opts.detail.message) + }) }) document.addEventListener('network.send', (e) => { @@ -338,8 +344,7 @@ window.accessibility = (opts) => new Proxy({ }) opts.xrf.addEventListener('pos', (opts) => { - if( this.enabled ){ - $chat.send({message: this.posToMessage(opts) }) + if( this.enabled && this.speak_teleports ){ network.send({message: this.posToMessage(opts), class:["info","guide"]}) } if( opts.frag.pos.string.match(/,/) ){ @@ -349,6 +354,53 @@ window.accessibility = (opts) => new Proxy({ } }) + setTimeout( () => this.initCommands(), 200 ) + // auto-enable if previously enabled + if( window.localStorage.getItem("accessibility") === 'true' ){ + setTimeout( () => { + this.enabled = true + this.setFontSize() + }, 100 ) + } + }, + + initCommands(){ + + document.addEventListener('chat.command.help', (e) => { + e.detail.message += `
/fontsize <number> set fontsize (default=14) ` + }) + + document.addEventListener('chat.command', (e) => { + if( e.detail.message.match(/^fontsize/) ){ + try{ + let fontsize = parseInt( e.detail.message.replace(/^fontsize /,'').trim() ) + if( fontsize == NaN ) throw 'not a number' + this.setFontSize(fontsize) + $chat.send({message:'fontsize set to '+fontsize}) + }catch(e){ + console.error(e) + $chat.send({message:'example usage: /fontsize 20'}) + } + } + }) + + }, + + setFontSize(size){ + if( size ){ + window.localStorage.setItem("fontsize",size) + }else size = window.localStorage.getItem("fontsize") + if( !size ) return + document.head.innerHTML += ` + + ` + $messages = document.querySelector('#messages') + setTimeout( () => $messages.scrollTop = $messages.scrollHeight, 1000 ) }, posToMessage(opts){ @@ -383,14 +435,17 @@ window.accessibility = (opts) => new Proxy({ data[k] = v switch( k ){ case "enabled": { - let message = "accessibility has been"+(v?"boosted":"lowered") + let message = "accessibility mode has been "+(v?"activated":"disabled")+".
Type /help for help." + if( v ) message = "
" + message $('#accessibility.btn').style.filter= v ? 'brightness(1.0)' : 'brightness(0.5)' if( v ) $chat.visible = true - $chat.send({message,class:['info','guide']}) + $chat.send({message,class:['info']}) data.enabled = true data.speak(message) data.enabled = v + window.localStorage.setItem("accessibility", v) $chat.$messages.classList[ v ? 'add' : 'remove' ]('guide') + document.body.classList.toggle(['accessibility']) if( !data.readTranscript && (data.readTranscript = true) ){ data.speak( data.sanitizeTranscript() ) } @@ -400,7 +455,6 @@ window.accessibility = (opts) => new Proxy({ }) document.addEventListener('$menu:ready', (e) => { - return try{ accessibility = accessibility(e.detail) accessibility.init() @@ -408,6 +462,35 @@ document.addEventListener('$menu:ready', (e) => { $menu.buttons = $menu.buttons.concat([`accessibility
`]) }catch(e){console.error(e)} }) + +document.querySelector('head').innerHTML += ` + +` + // reactive component for displaying the menu menuComponent = (el) => new Proxy({ @@ -570,8 +653,9 @@ window.frontend = (opts) => new Proxy({ ? "hold 2-3 fingers to move forward/backward" : "use WASD-keys and mouse-drag to move around" window.notify(instructions,{timeout:false}) - xrf.addEventListener('navigate', (opts) => { - window.notify('teleporting to '+opts.url+"

use back/forward browserbutton to undo") + xrf.addEventListener('pos', (opts) => { + let pos = opts.frag.pos.string + window.notify('teleporting to '+pos+"
use back/forward (browserbutton) to undo") }) // close dialogs when url changes },2000 ) @@ -594,13 +678,8 @@ window.frontend = (opts) => new Proxy({ } } } - let transcript = '' let root = data.mesh.portal ? data.mesh.portal.stencilObject : data.mesh - root.traverse( (n) => { - if( n.userData['aria-description'] && n.uuid != data.mesh.uuid ){ - transcript += `#${n.name} ${n.userData['aria-description']}. ` - } - }) + let transcript = xrf.sceneToTranscript(root,data.mesh) if( transcript.length ) html += `
transcript:
${transcript}
` if (hasMeta && !data.mesh.portal ) html += `

Visit embedded scene` @@ -834,4 +913,194 @@ window.frontend = (opts) => new Proxy({ }) frontend = frontend({xrf,document}).init() +// this allows surfing to a href by typing its node-name + +// help screen +document.addEventListener('chat.command.help', (e) => { + e.detail.message += ` +
<destinationname> surf to a destination + ` +}) + +document.addEventListener('chat.input', (e) => { + + let name = e.detail.message.trim() + xrf.scene.traverse( (n) => { + if( n.userData && n.userData.href && n.userData.href.match(/pos=/) && n.name == name ){ + $chat.send({message:'activating '+n.name, class:['self','info']}) + xrf.navigator.to( n.userData.href ) + } + }) + +}) +// this allows a more-or-less MUD type interface +// +// + + +// help screen +document.addEventListener('chat.command.help', (e) => { + e.detail.message += ` +
? help screen +
look view scene and destinations +
go [left|right|forward|destination] surf [to destination] +
do [action] list [or perform] action(s) +
rotate <left|right|up|down> rotate camera +
back go to previous portal/link +
forward go to previous portal/link +
#.... execute XR Fragments +
+ ` +}) + +const listExits = (scene) => { + let message = '' + let destinations = {} + scene.traverse( (n) => { + if( n.userData && n.userData.href && n.userData.href.match(/pos=/) ){ + destinations[n.name] = n.userData['aria-label'] || n.userData.href + } + }) + for( let destination in destinations ){ + message += `
${destination} ${destinations[destination]}` + } + if( !message ) message += '
type back to go back' + return message +} + +const listActions = (scene) => { + let message = '' + let destinations = {} + scene.traverse( (n) => { + if( n.userData && n.userData.href && !n.userData.href.match(/pos=/) ){ + destinations[n.name] = n.userData['aria-description'] || n.userData['aria-label'] || n.userData.href + } + }) + for( let destination in destinations ){ + message += `
${destination} ${destinations[destination]}` + } + if( !message ) message += '
no actions found' + return message +} + +document.addEventListener('chat.input', (e) => { + + if( e.detail.message.trim() == '?' ){ + document.dispatchEvent( new CustomEvent( 'chat.command', {detail:{message:"help"}} ) ) + e.detail.halt = true // don't send to other peers + } + + if( e.detail.message.trim() == 'look' ){ + let scene = xrf.frag.pos.last ? xrf.scene.getObjectByName(xrf.frag.pos.last) : xrf.scene + let message = `
${xrf.sceneToTranscript(scene)}

possible destinations in this area:${listExits(scene)}` + e.detail.halt = true // dont print command to screen + $chat.send({message}) + } + + if( e.detail.message.match(/^go($| )/) ){ + if( e.detail.message.trim() == 'go' ){ + $chat.send({message: `all possible destinations:${listExits(xrf.scene)}`}) + }else{ + let destination = e.detail.message.replace(/^go /,'').trim() + if( destination.match(/(left|right|forward|backward)/) ){ + let key = '' + switch( destination){ + case "left": key = 'ArrowLeft'; break; + case "right": key = 'ArrowRight'; break; + case "forward": key = 'ArrowUp'; break; + case "backward": key = 'ArrowDown'; break; + } + if( key ){ + let lookcontrols = document.querySelector('[look-controls]') + if( lookcontrols ) lookcontrols.removeAttribute('look-controls') // workaround to unlock camera + + var wasd = document.querySelector('[wasd-controls]').components['wasd-controls'] + wasd.keys[ key ] = true + wasd.velocity = new THREE.Vector3() + setTimeout( () => delete wasd.keys[ key ], 100 ) + wasd.el.object3D.matrixAutoUpdate = true; + wasd.el.object3D.updateMatrix() + xrf.camera.getCam().updateMatrix() + } + + }else{ + let node + xrf.scene.traverse( (n) => { + if( n.userData && n.userData.href && n.name == destination ) node = n + }) + if( node ) xrf.navigator.to( node.userData.href ) + else $chat.send({message:"type 'look' for possible destinations"}) + } + } + e.detail.halt = true // dont write input to chat + } + + if( e.detail.message.match(/^do($| )/) ){ + if( e.detail.message.trim() == 'do' ){ + $chat.send({message: `all possible actions:${listActions(xrf.scene)}`}) + }else{ + let action = e.detail.message.replace(/^do /,'').trim() + xrf.scene.traverse( (n) => { + if( n.userData && n.userData.href && n.name == action ){ + $chat.send({message:'activating '+n.name, class:['self','info']}) + xrf.navigator.to( n.userData.href ) + } + }) + } + e.detail.halt = true // dont write input to chat + } + + if( e.detail.message.match(/^rotate /) ){ + let dir = e.detail.message.replace(/^rotate /,'').trim() + let y = 0; + let x = 0; + switch(dir){ + case "left": y = 0.3; break; + case "right": y = -0.3; break; + case "up": x = 0.3; break; + case "down": x = -0.3; break; + } + let lookcontrols = document.querySelector('[look-controls]') + if( lookcontrols ) lookcontrols.removeAttribute('look-controls') // workaround to unlock camera + xrf.camera.rotation.y += y + xrf.camera.rotation.x += x + xrf.camera.matrixAutoUpdate = true + e.detail.halt = true // dont write input to chat + } + + if( e.detail.message.trim() == 'back' ){ + window.history.back() + } + + if( e.detail.message.trim() == 'forward' ){ + window.history.forward() + } + +}) +// this allows surfing to a href by typing its node-name + +// help screen +document.addEventListener('chat.command.help', (e) => { + e.detail.message += ` +
/speak_keyboard <true|false> turn on/off keyboard input TTS +
/speak_teleports <true|false> turn on/off TTS for teleports +
/speak_rate <1> adjust TTS speed +
/speak_pitch <1> adjust TTS pitch +
/speak_volume <1> adjust TTS volume +
/speak_voice <0> select voice (max: ${window.accessibility.speak_voices}) + ` +}) + +document.addEventListener('chat.command', (e) => { + if( !e.detail.message.trim().match(/ /) ) return + let action = e.detail.message.trim().split(" ")[0] + let value = e.detail.message.trim().split(" ")[1] + + if( window.accessibility[action] == undefined ) return + + window.accessibility[action] = value + window.localStorage.setItem(action, value ) + $chat.send({message: `${action} set to ${value}`, class:['info']}) + +}) }).apply({}) diff --git a/dist/xrfragment.plugin.network.js b/dist/xrfragment.plugin.network.js index cd3e0f0..b7db2ce 100644 --- a/dist/xrfragment.plugin.network.js +++ b/dist/xrfragment.plugin.network.js @@ -329,7 +329,9 @@ connectionsComponent = { set(data,k,v){ data[k] = v switch( k ){ - case "visible": el.style.display = v ? '' : 'none'; break; + case "visible": el.style.display = v ? '' : 'none'; + if( !v && el.parentNode && el.parentNode.parentNode ) el.parentNode.parentNode.remove() + break; case "webcam": $webcam.innerHTML = ``; break; case "chatnetwork": $chatnetwork.innerHTML = ``; break; case "scene": $scene.innerHTML = ``; break; @@ -386,12 +388,14 @@ chatComponent = { html: `
-
+
- +
`, @@ -409,6 +413,7 @@ chatComponent = { $messages: el.querySelector("#messages"), $chatline: el.querySelector("#chatline"), $chatbar: el.querySelector("#chatbar"), + $chatsend: el.querySelector("#chatsend"), install(opts){ this.opts = opts @@ -421,6 +426,19 @@ chatComponent = { this.send({message:`Welcome to ${document.location.search.substr(1)}, a 3D scene(file) which simply links to other ones.
You can start a solo offline exploration in XR right away.
Type /help below, or use the arrow- or WASD-keys on your keyboard, and mouse-drag to rotate.
`, class: ["info","guide","multiline"] }) }, + sendInput(value){ + if( value[0] == '#' ) return xrf.navigator.to(value) + let event = value.match(/^[!\/]/) ? "chat.command" : "network.send" + let message = value.replace(/^[!\/]/,'') + let raw = {detail:{message:value, halt:false}} + document.dispatchEvent( new CustomEvent( event, {detail: {message}} ) ) + document.dispatchEvent( new CustomEvent( "chat.input", raw ) ) + if( event == "network.send" && !raw.detail.halt ) this.send({message: value }) + this.$chatline.lastValue = value + this.$chatline.value = '' + if( window.innerHeight < 600 ) this.$chatline.blur() + }, + initListeners(){ let {$chatline} = this @@ -428,12 +446,10 @@ chatComponent = { $chatline.addEventListener('keydown', (e) => { if (e.key == 'Enter' ){ - if( $chatline.value[0] != '/' ){ - document.dispatchEvent( new CustomEvent("network.send", {detail: {message:$chatline.value}} ) ) - } - this.send({message: $chatline.value }) - $chatline.value = '' - if( window.innerHeight < 600 ) $chatline.blur() + this.sendInput($chatline.value) + } + if (e.key == 'ArrowUp' ){ + $chatline.value = $chatline.lastValue || '' } }) @@ -446,11 +462,26 @@ chatComponent = { if( e.detail.username ) this.username = e.detail.username }) + document.addEventListener('chat.command', (e) => { + if( String(e.detail.message).trim() == 'help' ){ + let detail = {message:`The following commands are available +

+ /help shows this help screen + `} + document.dispatchEvent( new CustomEvent( 'chat.command.help', {detail})) + this.send({message: detail.message}) + } + }) + + this.$chatsend.addEventListener('click', (e) => { + this.sendInput($chatline.value) + }) + }, inform(){ if( !this.inform.informed && (this.inform.informed = true) ){ - window.notify("Connected via P2P. You can now type message which will be visible to others.") + window.notify("You can now type messages in the textfield below.") } }, @@ -488,7 +519,7 @@ chatComponent = { br.classList.add.apply(br.classList, opts.class) div.classList.add.apply(div.classList, opts.class.concat(["envelope"])) } - if( msg.className.match(/(info|guide|ui)/) || !opts.from ){ + if( !msg.className.match(/(info|guide|ui)/) && !opts.from ){ let frag = xrf.URI.parse(document.location.hash).XRF opts.from = 'you' if( frag.pos ) opts.pos = frag.pos.string @@ -589,7 +620,7 @@ chatComponent.css = ` } #chatbar, - button#showchat{ + button#chatsend{ z-index: 1500; position: fixed; bottom: 24px; @@ -603,14 +634,19 @@ chatComponent.css = ` box-sizing: border-box; box-shadow: 0px 0px 5px 5px #0002; } - button#showchat{ - z-index:1550; - color:white; - border:0; - display:none; - height: 44px; - background:#07F; - font-weight:bold; + button#chatsend{ + line-height:0px; + display:none; + z-index: 1550; + color: white; + border: 0; + height: 35px; + background: var(--xrf-dark-gray); + font-weight: bold; + width: 20px; + max-width: 20px; + border-radius: 20px 0px 0px 20px; + overflow: hidden; } #chatbar input{ border:none; @@ -628,6 +664,7 @@ chatComponent.css = ` max-width: 500px; */ width:100%; + box-sizing:border-box; align-items: flex-start; position: absolute; transition:1s; @@ -636,7 +673,7 @@ chatComponent.css = ` bottom: 49px; padding: 20px; overflow:hidden; - overflow-y: scroll; + overflow-y: auto; pointer-events:none; transition:1s; z-index: 100; @@ -648,11 +685,14 @@ chatComponent.css = ` pointer-events:all; } #messages *{ + box-sizing:border-box; +/* pointer-events:none; -webkit-user-select:none; -moz-user-select:-moz-none; -ms-user-select:none; user-select:none; +*/ } #messages .msg{ transition:all 1s ease; @@ -667,7 +707,8 @@ chatComponent.css = ` cursor:grabbing; border: 1px solid #0002; } - #messages .msg *{ + #messages .msg *, + #messages .user *{ pointer-events:all; -webkit-user-select:text; -moz-user-select:-moz-text; @@ -677,17 +718,17 @@ chatComponent.css = ` #messages .msg.self{ border-radius: 20px; - background:var(--xrf-box-shadow); + background:var(--xrf-dark-gray); } #messages .msg.self, #messages .msg.self div{ color:#FFF; } #messages .msg.info{ - background: #473f7f; + background: var(--xrf-white); border-radius: 20px; - color: #FFF; - text-align: right; + color: var(--xrf-dark-gray); + text-align: left; line-height: 19px; } #messages .msg.info, @@ -696,7 +737,7 @@ chatComponent.css = ` } #messages .msg a { text-decoration:underline; - color: var(--xrf-primary); + color: var(--xrf-light-xrf-secondary); font-weight:bold; transition:0.3s; } @@ -773,9 +814,14 @@ chatComponent.css = ` margin:0; } + .envelope{ + margin-right:15px; + width:50%; + max-width:700px; + } + .envelope, .envelope * { - overflow:hidden; transition:1s; pointer-events:none; } @@ -796,5 +842,31 @@ chatComponent.css = ` .user, .user *{ font-size: var(--xrf-font-size-0); } + .gg-chevron-right-o { + color:#FFF; + box-sizing: border-box; + position: relative; + display: block; + transform: scale(var(--ggs,1)); + width: 22px; + height: 22px; + border: 2px solid; + border-radius: 100px + } + + .gg-chevron-right-o::after { + color:#FFF; + content: ""; + display: block; + box-sizing: border-box; + position: absolute; + width: 6px; + height: 6px; + border-bottom: 2px solid; + border-right: 2px solid; + transform: rotate(-45deg); + left: 5px; + top: 6px + } ` }).apply({}) diff --git a/dist/xrfragment.three.js b/dist/xrfragment.three.js index eb5b303..2469f85 100644 --- a/dist/xrfragment.three.js +++ b/dist/xrfragment.three.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Apr 16 04:44:20 PM UTC 2024 + * v0.5.1 generated at Thu Apr 25 03:56:52 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -1943,6 +1943,7 @@ xrf.parseModel = function(model,url){ let file = xrf.getFile(url) model.file = file model.isXRF = true + model.scene.isXRFRoot = true model.scene.traverse( (n) => n.isXRF = true ) // mark for deletion during reset() xrf.emit('parseModel',{model,url,file}) @@ -2015,10 +2016,12 @@ xrf.navigator.to = (url,flags,loader,data) => { let URI = xrfragment.URI.toAbsolute( xrf.navigator.URI, url ) URI.hash = xrf.navigator.reactifyHash(URI.hash) - let fileChange = URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file - let external = URI.URN != document.location.origin + document.location.pathname - let hasPos = URI.hash.pos - let hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") + // decorate with extra state + URI.fileChange = URI.file && URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file + URI.external = URI.file && URI.URN != document.location.origin + document.location.pathname + URI.hasPos = URI.hash.pos ? true : false + URI.duplicatePos = URI.source == xrf.navigator.URI.source && URI.hasPos + URI.hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") let hashbus = xrf.hashbus xrf.navigator.URI = URI let {directory,file,fragment,fileExt} = URI; @@ -2042,22 +2045,25 @@ xrf.navigator.to = (url,flags,loader,data) => { loader = loader || new Loader().setPath( URI.URN ) } - if( !URI.fragment && !URI.file && !URI.fileExt ) return resolve(xrf.model) // nothing we can do here - if( xrf.model && !fileChange && hashChange && !hasPos ){ + if( URI.duplicatePos || (!URI.fragment && !URI.file && !URI.fileExt) ){ + return resolve(xrf.model) // nothing we can do here + } + + if( xrf.model && !URI.fileChange && URI.hashChange && !URI.hasPos ){ evalFragment() - return resolve(xrf.model) // positional navigation + return resolve(xrf.model) // eval non-positional fragments (no loader needed) } xrf .emit('navigateLoading', {url,loader,data}) .then( () => { - if( (!fileChange || !file) && hashChange && hasPos ){ // we're already loaded + if( (!URI.fileChange || !file) && URI.hashChange && URI.hasPos ){ // we're already loaded evalFragment() xrf.emit('navigateLoaded',{url}) return resolve(xrf.model) } - + // clear xrf objects from scene if( xrf.model && xrf.model.scene ) xrf.model.scene.visible = false xrf.reset() @@ -2069,11 +2075,6 @@ xrf.navigator.to = (url,flags,loader,data) => { const onLoad = (model) => { model.file = URI.file - // only change url when loading *another* file - if( xrf.model ){ - xrf.navigator.pushState( external ? URI.URN + URI.file : URI.file, fragment ) - } - //if( xrf.model ) xrf.navigator.pushState( `${ document.location.pathname != URI.directory ? URI.directory: ''}${URI.file}`, fragment ) xrf.model = model if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model @@ -2088,12 +2089,17 @@ xrf.navigator.to = (url,flags,loader,data) => { model.scene.traverse( (mesh) => xrf.parseModel.metadataInMesh(mesh,model) ) } // spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view) - xrf.frag.defaultPredefinedViews({model,scene:model.scene}) + const defaultFragment = xrf.frag.defaultPredefinedViews({model,scene:model.scene}) // spec: predefined view(s) & objects-of-interest-in-XRWG from URI (https://xrfragment.org/#predefined_view) let frag = xrf.hashbus.pub( url, model) // and eval URI XR fragments - + xrf.add( model.scene ) - if( fragment ) xrf.navigator.updateHash(fragment) + + // only change url when loading *another* file + fragment = fragment || defaultFragment || '' + xrf.navigator.pushState( URI.external ? URI.URN + URI.file : URI.file, fragment.replace(/^#/,'') ) + //if( fragment ) xrf.navigator.updateHash(fragment) + xrf.emit('navigateLoaded',{url,model}) resolve(model) } @@ -2120,7 +2126,7 @@ xrf.navigator.init = () => { window.addEventListener('popstate', function (event){ if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) - xrf.navigator.to( document.location.href.replace(/\?/,'') ) + xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) } }) @@ -2356,13 +2362,16 @@ xrf.addEventListener('audioInited', function(opts){ xrf.frag.defaultPredefinedViews = (opts) => { let {scene,model} = opts; + let defaultFragment; scene.traverse( (n) => { if( n.userData && n.userData['#'] ){ - if( !n.parent && !document.location.hash ){ - xrf.navigator.to( n.userData['#'] ) - }else xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL + if( n.isXRFRoot ){ + defaultFragment = n.userData['#'] + } + xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL } }) + return defaultFragment } xrf.frag.loop = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -2402,7 +2411,7 @@ xrf.frag.pos = function(v, opts){ if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) - xrf.frag.pos.last = pos // remember + xrf.frag.pos.last = v.string // remember camera.updateMatrixWorld() } @@ -3146,6 +3155,17 @@ xrf.optimize.removeDuplicateLights = () => { xrf.addEventListener('parseModel', (opts) => { xrf.optimize(opts) }) +xrf.sceneToTranscript = (scene, ignoreMesh ) => { + let transcript = '' + scene.traverse( (n) => { + let isSRC = false + n.traverseAncestors( (m) => m.userData.src ? isSRC = true : false ) + if( !isSRC && n.userData['aria-description'] && (!ignoreMesh || n.uuid != ignoreMesh.uuid) ){ + transcript += `#${n.name} ${n.userData['aria-description']}. ` + } + }) + return transcript +} // switch camera when multiple cameras for url #mycameraname xrf.addEventListener('dynamicKey', (opts) => { diff --git a/dist/xrfragment.three.module.js b/dist/xrfragment.three.module.js index 119b499..1d8d5cd 100644 --- a/dist/xrfragment.three.module.js +++ b/dist/xrfragment.three.module.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Apr 16 04:44:20 PM UTC 2024 + * v0.5.1 generated at Thu Apr 25 03:56:52 PM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -1943,6 +1943,7 @@ xrf.parseModel = function(model,url){ let file = xrf.getFile(url) model.file = file model.isXRF = true + model.scene.isXRFRoot = true model.scene.traverse( (n) => n.isXRF = true ) // mark for deletion during reset() xrf.emit('parseModel',{model,url,file}) @@ -2015,10 +2016,12 @@ xrf.navigator.to = (url,flags,loader,data) => { let URI = xrfragment.URI.toAbsolute( xrf.navigator.URI, url ) URI.hash = xrf.navigator.reactifyHash(URI.hash) - let fileChange = URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file - let external = URI.URN != document.location.origin + document.location.pathname - let hasPos = URI.hash.pos - let hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") + // decorate with extra state + URI.fileChange = URI.file && URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file + URI.external = URI.file && URI.URN != document.location.origin + document.location.pathname + URI.hasPos = URI.hash.pos ? true : false + URI.duplicatePos = URI.source == xrf.navigator.URI.source && URI.hasPos + URI.hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") let hashbus = xrf.hashbus xrf.navigator.URI = URI let {directory,file,fragment,fileExt} = URI; @@ -2042,22 +2045,25 @@ xrf.navigator.to = (url,flags,loader,data) => { loader = loader || new Loader().setPath( URI.URN ) } - if( !URI.fragment && !URI.file && !URI.fileExt ) return resolve(xrf.model) // nothing we can do here - if( xrf.model && !fileChange && hashChange && !hasPos ){ + if( URI.duplicatePos || (!URI.fragment && !URI.file && !URI.fileExt) ){ + return resolve(xrf.model) // nothing we can do here + } + + if( xrf.model && !URI.fileChange && URI.hashChange && !URI.hasPos ){ evalFragment() - return resolve(xrf.model) // positional navigation + return resolve(xrf.model) // eval non-positional fragments (no loader needed) } xrf .emit('navigateLoading', {url,loader,data}) .then( () => { - if( (!fileChange || !file) && hashChange && hasPos ){ // we're already loaded + if( (!URI.fileChange || !file) && URI.hashChange && URI.hasPos ){ // we're already loaded evalFragment() xrf.emit('navigateLoaded',{url}) return resolve(xrf.model) } - + // clear xrf objects from scene if( xrf.model && xrf.model.scene ) xrf.model.scene.visible = false xrf.reset() @@ -2069,11 +2075,6 @@ xrf.navigator.to = (url,flags,loader,data) => { const onLoad = (model) => { model.file = URI.file - // only change url when loading *another* file - if( xrf.model ){ - xrf.navigator.pushState( external ? URI.URN + URI.file : URI.file, fragment ) - } - //if( xrf.model ) xrf.navigator.pushState( `${ document.location.pathname != URI.directory ? URI.directory: ''}${URI.file}`, fragment ) xrf.model = model if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model @@ -2088,12 +2089,17 @@ xrf.navigator.to = (url,flags,loader,data) => { model.scene.traverse( (mesh) => xrf.parseModel.metadataInMesh(mesh,model) ) } // spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view) - xrf.frag.defaultPredefinedViews({model,scene:model.scene}) + const defaultFragment = xrf.frag.defaultPredefinedViews({model,scene:model.scene}) // spec: predefined view(s) & objects-of-interest-in-XRWG from URI (https://xrfragment.org/#predefined_view) let frag = xrf.hashbus.pub( url, model) // and eval URI XR fragments - + xrf.add( model.scene ) - if( fragment ) xrf.navigator.updateHash(fragment) + + // only change url when loading *another* file + fragment = fragment || defaultFragment || '' + xrf.navigator.pushState( URI.external ? URI.URN + URI.file : URI.file, fragment.replace(/^#/,'') ) + //if( fragment ) xrf.navigator.updateHash(fragment) + xrf.emit('navigateLoaded',{url,model}) resolve(model) } @@ -2120,7 +2126,7 @@ xrf.navigator.init = () => { window.addEventListener('popstate', function (event){ if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) - xrf.navigator.to( document.location.href.replace(/\?/,'') ) + xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) } }) @@ -2356,13 +2362,16 @@ xrf.addEventListener('audioInited', function(opts){ xrf.frag.defaultPredefinedViews = (opts) => { let {scene,model} = opts; + let defaultFragment; scene.traverse( (n) => { if( n.userData && n.userData['#'] ){ - if( !n.parent && !document.location.hash ){ - xrf.navigator.to( n.userData['#'] ) - }else xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL + if( n.isXRFRoot ){ + defaultFragment = n.userData['#'] + } + xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL } }) + return defaultFragment } xrf.frag.loop = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts @@ -2402,7 +2411,7 @@ xrf.frag.pos = function(v, opts){ if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) - xrf.frag.pos.last = pos // remember + xrf.frag.pos.last = v.string // remember camera.updateMatrixWorld() } @@ -3146,6 +3155,17 @@ xrf.optimize.removeDuplicateLights = () => { xrf.addEventListener('parseModel', (opts) => { xrf.optimize(opts) }) +xrf.sceneToTranscript = (scene, ignoreMesh ) => { + let transcript = '' + scene.traverse( (n) => { + let isSRC = false + n.traverseAncestors( (m) => m.userData.src ? isSRC = true : false ) + if( !isSRC && n.userData['aria-description'] && (!ignoreMesh || n.uuid != ignoreMesh.uuid) ){ + transcript += `#${n.name} ${n.userData['aria-description']}. ` + } + }) + return transcript +} // switch camera when multiple cameras for url #mycameraname xrf.addEventListener('dynamicKey', (opts) => {